Minor - use str_contains instead of strpos (php 8) + format code

pull/3924/head
Julio Montoya 4 years ago
parent decca0d0c0
commit 430d79b9b4
  1. 2
      public/main/inc/lib/document.lib.php
  2. 2
      public/main/survey/surveyUtil.class.php
  3. 4
      src/CoreBundle/Entity/Asset.php
  4. 6
      src/CoreBundle/Entity/ResourceFile.php
  5. 6
      src/CoreBundle/Entity/ResourceNode.php

@ -6188,7 +6188,7 @@ This folder contains all sessions that have been opened in the chat. Although th
$em->flush(); $em->flush();
if (!empty($content)) { if (!empty($content)) {
$repo = Container::getDocumentRepository(); $repo = Container::getDocumentRepository();
$repo->addFileFromString($document, $realPath, 'text/html', $content, true); $repo->addFileFromString($document, $title, 'text/html', $content, true);
} }
if ($document) { if ($document) {

@ -1999,7 +1999,7 @@ class SurveyUtil
ICON_SIZE_MEDIUM ICON_SIZE_MEDIUM
) )
.'</a>'; .'</a>';
echo Display::toolbarAction('survey', [$actions]); echo Display::toolbarAction('survey', [$actions]);
// Displaying an information message that only the questions with predefined answers can be used in a comparative report // Displaying an information message that only the questions with predefined answers can be used in a comparative report
echo Display::return_message(get_lang('Only questions with predefined answers can be used'), 'normal', false); echo Display::return_message(get_lang('Only questions with predefined answers can be used'), 'normal', false);

@ -160,14 +160,14 @@ class Asset
{ {
$mimeType = $this->getMimeType(); $mimeType = $this->getMimeType();
return false !== strpos($mimeType, 'image'); return str_contains($mimeType, 'image');
} }
public function isVideo(): bool public function isVideo(): bool
{ {
$mimeType = $this->getMimeType(); $mimeType = $this->getMimeType();
return false !== strpos($mimeType, 'video'); return str_contains($mimeType, 'video');
} }
/** /**

@ -186,21 +186,21 @@ class ResourceFile
{ {
$mimeType = $this->getMimeType(); $mimeType = $this->getMimeType();
return false !== strpos($mimeType, 'text'); return str_contains($mimeType, 'text');
} }
public function isImage(): bool public function isImage(): bool
{ {
$mimeType = $this->getMimeType(); $mimeType = $this->getMimeType();
return false !== strpos($mimeType, 'image'); return str_contains($mimeType, 'image');
} }
public function isVideo(): bool public function isVideo(): bool
{ {
$mimeType = $this->getMimeType(); $mimeType = $this->getMimeType();
return false !== strpos($mimeType, 'video'); return str_contains($mimeType, 'video');
} }
public function getName(): ?string public function getName(): ?string

@ -471,7 +471,7 @@ class ResourceNode
{ {
if ($this->hasResourceFile()) { if ($this->hasResourceFile()) {
$mimeType = $this->getResourceFile()->getMimeType(); $mimeType = $this->getResourceFile()->getMimeType();
if (false !== strpos($mimeType, 'text')) { if (str_contains($mimeType, 'text')) {
return true; return true;
} }
} }
@ -483,7 +483,7 @@ class ResourceNode
{ {
if ($this->hasResourceFile()) { if ($this->hasResourceFile()) {
$mimeType = $this->getResourceFile()->getMimeType(); $mimeType = $this->getResourceFile()->getMimeType();
if (false !== strpos($mimeType, 'image')) { if (str_contains($mimeType, 'image')) {
return true; return true;
} }
} }
@ -495,7 +495,7 @@ class ResourceNode
{ {
if ($this->hasResourceFile()) { if ($this->hasResourceFile()) {
$mimeType = $this->getResourceFile()->getMimeType(); $mimeType = $this->getResourceFile()->getMimeType();
if (false !== strpos($mimeType, 'video')) { if (str_contains($mimeType, 'video')) {
return true; return true;
} }
} }

Loading…
Cancel
Save