diff --git a/public/main/exercise/admin.php b/public/main/exercise/admin.php index 840277452d..4d13c829b5 100644 --- a/public/main/exercise/admin.php +++ b/public/main/exercise/admin.php @@ -375,7 +375,7 @@ if ($inATest) { if (false === $showPagination) { if ($objExercise->questionSelectionType >= EX_Q_SELECTION_CATEGORIES_ORDERED_QUESTIONS_ORDERED) { $alert .= sprintf( - '
'.get_lang('XQuestionsSelectedWithTotalScoreY'), + '
'.get_lang('Only %d questions will be selected based on the test configuration, for a total score of %s.'), count($questionList), $maxScoreAllQuestions ); diff --git a/public/main/tracking/exams.php b/public/main/tracking/exams.php index 6aeff05bda..6245ed5eab 100644 --- a/public/main/tracking/exams.php +++ b/public/main/tracking/exams.php @@ -77,7 +77,16 @@ if ($global) { $form->addElement('select', 'exercise_id', get_lang('Exercise'), $exerciseList); } } -$form->addButton('filter', get_lang('Filter'), 'filter', 'primary', null, null, ['style' => 'margin-top: 5px; margin-left: 15px;']); + +$form->addButton( + 'filter', + get_lang('Filter'), + 'filter', + 'primary', + null, + null, + ['style' => 'margin-top: 5px; margin-left: 15px;'] +); $filter_score = isset($_REQUEST['score']) ? intval($_REQUEST['score']) : 70; $exerciseId = isset($_REQUEST['exercise_id']) ? intval($_REQUEST['exercise_id']) : 0; diff --git a/src/CoreBundle/Component/Editor/Editor.php b/src/CoreBundle/Component/Editor/Editor.php index 8510580a21..c52c7ec722 100644 --- a/src/CoreBundle/Component/Editor/Editor.php +++ b/src/CoreBundle/Component/Editor/Editor.php @@ -109,7 +109,7 @@ class Editor */ public function processConfig($config): void { - if (is_array($config)) { + if (\is_array($config)) { foreach ($config as $key => $value) { switch ($key) { case 'ToolbarSet': @@ -166,7 +166,7 @@ class Editor */ protected function toJavascript($var) { - switch (gettype($var)) { + switch (\gettype($var)) { case 'boolean': return $var ? 'true' : 'false'; // Lowercase necessary! case 'integer': @@ -185,7 +185,7 @@ class Editor // Arrays in JSON can't be associative. If the array is empty or if it // has sequential whole number keys starting with 0, it's not associative // so we can go ahead and convert it as an array. - if (empty($var) || array_keys($var) === range(0, count($var) - 1)) { + if (empty($var) || array_keys($var) === range(0, \count($var) - 1)) { $output = []; foreach ($var as $v) { $output[] = $this->toJavascript($v); diff --git a/src/CoreBundle/Component/Utils/AssetDirectoryNamer.php b/src/CoreBundle/Component/Utils/AssetDirectoryNamer.php index a652e9e3d1..aa869d8cbd 100644 --- a/src/CoreBundle/Component/Utils/AssetDirectoryNamer.php +++ b/src/CoreBundle/Component/Utils/AssetDirectoryNamer.php @@ -39,7 +39,7 @@ class AssetDirectoryNamer implements DirectoryNamerInterface, ConfigurableInterf $this->propertyPath = $options['property']; - $options = \array_merge([ + $options = array_merge([ 'chars_per_dir' => $this->charsPerDir, 'dirs' => $this->dirs, ], $options); @@ -57,12 +57,12 @@ class AssetDirectoryNamer implements DirectoryNamerInterface, ConfigurableInterf if (Asset::EXTRA_FIELD === $category) { for ($i = 0, $start = 0; $i < $this->dirs; $i++, $start += $this->charsPerDir) { - $parts[] = \substr($fileName, $start, $this->charsPerDir); + $parts[] = substr($fileName, $start, $this->charsPerDir); } } else { $parts[] = $fileName; } - return \implode('/', $parts); + return implode('/', $parts); } } diff --git a/src/CoreBundle/Component/Utils/ChamiloApi.php b/src/CoreBundle/Component/Utils/ChamiloApi.php index 0dc112ade1..317beb20c5 100644 --- a/src/CoreBundle/Component/Utils/ChamiloApi.php +++ b/src/CoreBundle/Component/Utils/ChamiloApi.php @@ -14,6 +14,7 @@ use DateTimeZone; use Display; use Exception; use Template; +use const PHP_SAPI; class ChamiloApi { @@ -41,7 +42,7 @@ class ChamiloApi public static function getConfigurationValue(string $variable) { $configuration = self::getConfigurationArray(); - if (array_key_exists($variable, $configuration)) { + if (\array_key_exists($variable, $configuration)) { return $configuration[$variable]; } @@ -258,7 +259,7 @@ class ChamiloApi 'first' ); - if (is_array($row) && isset($row['id'])) { + if (\is_array($row) && isset($row['id'])) { return $row['id']; } @@ -367,7 +368,7 @@ class ChamiloApi } } // If we want more colors, loop through existing colors - $count = count($palette); + $count = \count($palette); if (isset($fillUpTo) && $fillUpTo > $count) { for ($i = $count; $i < $fillUpTo; $i++) { $palette[$i] = $palette[$i % $count]; diff --git a/src/CoreBundle/Composer/ScriptHandler.php b/src/CoreBundle/Composer/ScriptHandler.php index 1b3c4b1d5c..415a7ac56c 100644 --- a/src/CoreBundle/Composer/ScriptHandler.php +++ b/src/CoreBundle/Composer/ScriptHandler.php @@ -23,7 +23,7 @@ class ScriptHandler $fs = new Filesystem(); $fs->mirror($appCss, $newPath, null, ['override' => true]);*/ - if (function_exists('opcache_reset')) { + if (\function_exists('opcache_reset')) { opcache_reset(); } } @@ -282,7 +282,7 @@ class ScriptHandler // Loop through the folder. $dir = dir($dirname); // A sanity check. - $is_object_dir = is_object($dir); + $is_object_dir = \is_object($dir); if ($is_object_dir) { while (false !== $entry = $dir->read()) { // Skip pointers. diff --git a/src/CoreBundle/Controller/AccountController.php b/src/CoreBundle/Controller/AccountController.php index f0be69506e..e562c89b74 100644 --- a/src/CoreBundle/Controller/AccountController.php +++ b/src/CoreBundle/Controller/AccountController.php @@ -34,7 +34,7 @@ class AccountController extends BaseController { $user = $this->getUser(); - if (!is_object($user) || !$user instanceof UserInterface) { + if (!\is_object($user) || !$user instanceof UserInterface) { throw $this->createAccessDeniedException('This user does not have access to this section'); } diff --git a/src/CoreBundle/Controller/Admin/SettingsController.php b/src/CoreBundle/Controller/Admin/SettingsController.php index 4cbb93dd67..423e1fb9b2 100644 --- a/src/CoreBundle/Controller/Admin/SettingsController.php +++ b/src/CoreBundle/Controller/Admin/SettingsController.php @@ -81,7 +81,7 @@ class SettingsController extends BaseController $form = $this->getSettingsFormFactory()->create($schemaAlias); foreach (array_keys($settings->getParameters()) as $name) { - if (!in_array($name, $list, true)) { + if (!\in_array($name, $list, true)) { $form->remove($name); $settings->remove($name); } @@ -152,7 +152,7 @@ class SettingsController extends BaseController if (!empty($keyword)) { $params = $settings->getParameters(); foreach (array_keys($params) as $name) { - if (!array_key_exists($name, $settingsFromKeyword)) { + if (!\array_key_exists($name, $settingsFromKeyword)) { $form->remove($name); } } diff --git a/src/CoreBundle/Controller/Api/UpdateResourceNodeFileAction.php b/src/CoreBundle/Controller/Api/UpdateResourceNodeFileAction.php index d3dae9ce5e..aa1a862601 100644 --- a/src/CoreBundle/Controller/Api/UpdateResourceNodeFileAction.php +++ b/src/CoreBundle/Controller/Api/UpdateResourceNodeFileAction.php @@ -39,7 +39,7 @@ class UpdateResourceNodeFileAction $resourceNode = $document->getResourceNode(); if ($resourceNode->hasResourceFile()) { $resourceNode->setContent($content); - $resourceNode->getResourceFile()->setSize(strlen($content)); + $resourceNode->getResourceFile()->setSize(\strlen($content)); } $resourceNode->setUpdatedAt(new DateTime()); $resourceNode->getResourceFile()->setUpdatedAt(new DateTime()); diff --git a/src/CoreBundle/Controller/AssetController.php b/src/CoreBundle/Controller/AssetController.php index 0c1f4a1d41..2501dd18bf 100644 --- a/src/CoreBundle/Controller/AssetController.php +++ b/src/CoreBundle/Controller/AssetController.php @@ -37,7 +37,7 @@ class AssetController $response = new StreamedResponse( function () use ($stream): void { - stream_copy_to_stream($stream, fopen('php://output', 'wb')); + stream_copy_to_stream($stream, fopen('php://output', 'w')); } ); $disposition = $response->headers->makeDisposition( diff --git a/src/CoreBundle/Controller/ResourceController.php b/src/CoreBundle/Controller/ResourceController.php index bf48b4934d..96c3636401 100644 --- a/src/CoreBundle/Controller/ResourceController.php +++ b/src/CoreBundle/Controller/ResourceController.php @@ -606,7 +606,7 @@ class ResourceController extends AbstractResourceController implements CourseCon $qb->addCriteria($criteria); /** @var ArrayCollection|ResourceNode[] $children */ $children = $qb->getQuery()->getResult(); - $count = count($children); + $count = \count($children); if (0 === $count) { $params = $this->getResourceParams($request); $params['id'] = $id; @@ -733,7 +733,7 @@ class ResourceController extends AbstractResourceController implements CourseCon $response = new StreamedResponse( function () use ($stream): void { - stream_copy_to_stream($stream, fopen('php://output', 'wb')); + stream_copy_to_stream($stream, fopen('php://output', 'w')); } ); $disposition = $response->headers->makeDisposition( diff --git a/src/CoreBundle/Controller/SessionController.php b/src/CoreBundle/Controller/SessionController.php index a1096e346c..be285bbf5a 100644 --- a/src/CoreBundle/Controller/SessionController.php +++ b/src/CoreBundle/Controller/SessionController.php @@ -208,7 +208,7 @@ class SessionController extends AbstractController $redirectToSession = $redirectToSession ? '?s='.$sessionId : false; $coursesInThisSession = SessionManager::get_course_list_by_session_id($sessionId); - $coursesCount = count($coursesInThisSession); + $coursesCount = \count($coursesInThisSession); $redirectToSession = 1 === $coursesCount && $redirectToSession ? ($redirectToSession.'&cr='.array_values($coursesInThisSession)[0]['directory']) : $redirectToSession; diff --git a/src/CoreBundle/Controller/UserController.php b/src/CoreBundle/Controller/UserController.php index ac68d970a0..2b21b99d8f 100644 --- a/src/CoreBundle/Controller/UserController.php +++ b/src/CoreBundle/Controller/UserController.php @@ -28,7 +28,7 @@ class UserController extends AbstractController { $user = $userRepository->findByUsername($username); - if (!is_object($user) || !$user instanceof UserInterface) { + if (!\is_object($user) || !$user instanceof UserInterface) { throw $this->createAccessDeniedException('This user does not have access to this section'); } diff --git a/src/CoreBundle/Entity/Course.php b/src/CoreBundle/Entity/Course.php index 90333582c2..6342f27a22 100644 --- a/src/CoreBundle/Entity/Course.php +++ b/src/CoreBundle/Entity/Course.php @@ -1015,7 +1015,7 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith self::OPEN_WORLD, ]; - return in_array($this->visibility, $activeVisibilityList, true); + return \in_array($this->visibility, $activeVisibilityList, true); } /** diff --git a/src/CoreBundle/Entity/Group.php b/src/CoreBundle/Entity/Group.php index f69ee0873c..4397e6f564 100644 --- a/src/CoreBundle/Entity/Group.php +++ b/src/CoreBundle/Entity/Group.php @@ -71,7 +71,7 @@ class Group public function hasRole(string $role): bool { - return in_array(strtoupper($role), $this->roles, true); + return \in_array(strtoupper($role), $this->roles, true); } public function getRoles(): array diff --git a/src/CoreBundle/Entity/Listener/ResourceListener.php b/src/CoreBundle/Entity/Listener/ResourceListener.php index 93979cbb17..1a3e6a810c 100644 --- a/src/CoreBundle/Entity/Listener/ResourceListener.php +++ b/src/CoreBundle/Entity/Listener/ResourceListener.php @@ -76,7 +76,7 @@ class ResourceListener public function prePersist(AbstractResource $resource, LifecycleEventArgs $event) { - error_log('Resource listener prePersist for obj: '.get_class($resource)); + error_log('Resource listener prePersist for obj: '.\get_class($resource)); $em = $event->getEntityManager(); $request = $this->request; @@ -112,7 +112,7 @@ class ResourceListener // @todo use static table instead of Doctrine $repo = $em->getRepository(ResourceType::class); - $entityClass = get_class($event->getEntity()); + $entityClass = \get_class($event->getEntity()); $repoClass = str_replace('Entity', 'Repository', $entityClass).'Repository'; if (strpos($repoClass, 'CoreBundle')) { $repoClass = str_replace('Entity', 'Repository\Node', $entityClass).'Repository'; diff --git a/src/CoreBundle/Entity/ResourceLink.php b/src/CoreBundle/Entity/ResourceLink.php index f117de4bbe..7557f3226f 100644 --- a/src/CoreBundle/Entity/ResourceLink.php +++ b/src/CoreBundle/Entity/ResourceLink.php @@ -267,7 +267,7 @@ class ResourceLink public function setVisibility(int $visibility): self { - if (!in_array($visibility, self::getVisibilityList(), true)) { + if (!\in_array($visibility, self::getVisibilityList(), true)) { throw new LogicException('The visibility is not valid'); } diff --git a/src/CoreBundle/Entity/Session.php b/src/CoreBundle/Entity/Session.php index af462d667e..8500f5e150 100644 --- a/src/CoreBundle/Entity/Session.php +++ b/src/CoreBundle/Entity/Session.php @@ -837,7 +837,7 @@ class Session $relCourse = $this->getCourseSubscription($course); if (null !== $relCourse) { $this->courses->removeElement($relCourse); - $this->setNbrCourses(count($this->courses)); + $this->setNbrCourses(\count($this->courses)); return true; } diff --git a/src/CoreBundle/Entity/User.php b/src/CoreBundle/Entity/User.php index 2478f164a5..5c4afeca47 100644 --- a/src/CoreBundle/Entity/User.php +++ b/src/CoreBundle/Entity/User.php @@ -1397,7 +1397,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso public function hasGroup(string $name): bool { - return in_array($name, $this->getGroupNames(), true); + return \in_array($name, $this->getGroupNames(), true); } public function getGroupNames(): array @@ -1711,7 +1711,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso public function hasRole(string $role): bool { - return in_array(strtoupper($role), $this->getRoles(), true); + return \in_array(strtoupper($role), $this->getRoles(), true); } /** @@ -1751,7 +1751,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso return $this; } - if (!in_array($role, $this->roles, true)) { + if (!\in_array($role, $this->roles, true)) { $this->roles[] = $role; } diff --git a/src/CoreBundle/EventListener/CourseListener.php b/src/CoreBundle/EventListener/CourseListener.php index 87d7dbbb60..8663ee3a4f 100644 --- a/src/CoreBundle/EventListener/CourseListener.php +++ b/src/CoreBundle/EventListener/CourseListener.php @@ -219,7 +219,7 @@ class CourseListener { $controllerList = $event->getController(); - if (!is_array($controllerList)) { + if (!\is_array($controllerList)) { return; } @@ -246,7 +246,7 @@ class CourseListener //$cidReset = $sessionHandler->get('cid_reset', false); // This controller implements ToolInterface? Then set the course/session - if (is_array($controllerList) && + if (\is_array($controllerList) && ( $controllerList[0] instanceof CourseControllerInterface || $controllerList[0] instanceof EditorController diff --git a/src/CoreBundle/EventListener/LoginSuccessHandler.php b/src/CoreBundle/EventListener/LoginSuccessHandler.php index 13b539d44a..619ea3d192 100644 --- a/src/CoreBundle/EventListener/LoginSuccessHandler.php +++ b/src/CoreBundle/EventListener/LoginSuccessHandler.php @@ -110,7 +110,7 @@ class LoginSuccessHandler } } - $count_of_sessions = count($my_session_list); + $count_of_sessions = \count($my_session_list); if (1 === $count_of_sessions && 0 === $count_of_courses_no_sessions) { $key = array_keys($personal_course_list); $course_info = $personal_course_list[$key[0]]['course_info']; diff --git a/src/CoreBundle/EventSubscriber/PaginationSubscriber.php b/src/CoreBundle/EventSubscriber/PaginationSubscriber.php index 2a0f4eef63..3902600f1b 100644 --- a/src/CoreBundle/EventSubscriber/PaginationSubscriber.php +++ b/src/CoreBundle/EventSubscriber/PaginationSubscriber.php @@ -15,16 +15,16 @@ class PaginationSubscriber implements EventSubscriberInterface { public function items(ItemsEvent $event): void { - if (is_array($event->target)) { + if (\is_array($event->target)) { $event->items = $event->target; - $event->count = count($event->target); + $event->count = \count($event->target); $event->stopPropagation(); } } public function pagination(PaginationEvent $event): void { - if (is_array($event->target)) { + if (\is_array($event->target)) { $event->setPagination(new SlidingPagination()); } diff --git a/src/CoreBundle/EventSubscriber/ResolveResourceFileContentUrlSubscriber.php b/src/CoreBundle/EventSubscriber/ResolveResourceFileContentUrlSubscriber.php index 9b2b36dcd2..23c8582f64 100644 --- a/src/CoreBundle/EventSubscriber/ResolveResourceFileContentUrlSubscriber.php +++ b/src/CoreBundle/EventSubscriber/ResolveResourceFileContentUrlSubscriber.php @@ -47,7 +47,7 @@ class ResolveResourceFileContentUrlSubscriber implements EventSubscriberInterfac if (!($attributes = RequestAttributesExtractor::extractAttributes($request)) || //!\is_a($attributes['resource_class'], ResourceFile::class, true) - !\is_a($attributes['resource_class'], AbstractResource::class, true) + !is_a($attributes['resource_class'], AbstractResource::class, true) ) { return; } diff --git a/src/CoreBundle/Migrations/AbstractMigrationChamilo.php b/src/CoreBundle/Migrations/AbstractMigrationChamilo.php index 785319bcc2..ece15055c7 100644 --- a/src/CoreBundle/Migrations/AbstractMigrationChamilo.php +++ b/src/CoreBundle/Migrations/AbstractMigrationChamilo.php @@ -143,7 +143,7 @@ abstract class AbstractMigrationChamilo extends AbstractMigration implements Con $this->getEntityManager()->persist($setting); - if (count($options) > 0) { + if (\count($options) > 0) { foreach ($options as $option) { if (empty($option['text'])) { if ('true' === $option['value']) { @@ -198,7 +198,7 @@ abstract class AbstractMigrationChamilo extends AbstractMigration implements Con $description = '' ): void { if (!is_dir($filePath)) { - $class = get_class($resource); + $class = \get_class($resource); $documentPath = basename($filePath); if (file_exists($filePath)) { $mimeType = mime_content_type($filePath); diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20191206150030.php b/src/CoreBundle/Migrations/Schema/V200/Version20191206150030.php index 248c447204..c4a38ed6fb 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20191206150030.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20191206150030.php @@ -36,7 +36,7 @@ class Version20191206150030 extends AbstractMigrationChamilo /** @var ExtraFieldValues $item */ foreach ($q->toIterable() as $item) { - if (in_array($item->getField()->getFieldType(), $fieldWithFiles, true)) { + if (\in_array($item->getField()->getFieldType(), $fieldWithFiles, true)) { $path = $item->getValue(); if (empty($path)) { continue; diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20201212203625.php b/src/CoreBundle/Migrations/Schema/V200/Version20201212203625.php index e3039dd95d..a6f70c1d02 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20201212203625.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20201212203625.php @@ -75,12 +75,12 @@ final class Version20201212203625 extends AbstractMigrationChamilo $resourceNode = null; $parent = null; - if ('.' !== dirname($documentPath)) { + if ('.' !== \dirname($documentPath)) { $parentId = DocumentManager::get_document_id( [ 'real_id' => $courseId, ], - dirname($documentPath) + \dirname($documentPath) ); $parent = $documentRepo->find($parentId); } diff --git a/src/CoreBundle/Repository/LegalRepository.php b/src/CoreBundle/Repository/LegalRepository.php index 47dc54e9f8..48666077b4 100644 --- a/src/CoreBundle/Repository/LegalRepository.php +++ b/src/CoreBundle/Repository/LegalRepository.php @@ -33,7 +33,7 @@ class LegalRepository extends ServiceEntityRepository ->groupBy('l.languageId') ; - return count($qb->getQuery()->getResult()); + return \count($qb->getQuery()->getResult()); } /** diff --git a/src/CoreBundle/Repository/Node/UserRepository.php b/src/CoreBundle/Repository/Node/UserRepository.php index 9f7ae38b5a..5d0dac2114 100644 --- a/src/CoreBundle/Repository/Node/UserRepository.php +++ b/src/CoreBundle/Repository/Node/UserRepository.php @@ -1386,7 +1386,7 @@ class UserRepository extends ResourceRepository implements UserLoaderInterface, 'memberSince' => $callback, ], AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER => function ($object, $format, $context) { - return get_class($object); + return \get_class($object); }, ]; diff --git a/src/CoreBundle/Repository/ResourceRepository.php b/src/CoreBundle/Repository/ResourceRepository.php index 5c51bcbfd9..47db04ddaa 100644 --- a/src/CoreBundle/Repository/ResourceRepository.php +++ b/src/CoreBundle/Repository/ResourceRepository.php @@ -714,7 +714,7 @@ abstract class ResourceRepository extends ServiceEntityRepository if ($resourceNode->hasResourceFile()) { $resourceNode->setContent($content); error_log('updated'); - $resourceNode->getResourceFile()->setSize(strlen($content)); + $resourceNode->getResourceFile()->setSize(\strlen($content)); /* error_log('has file'); $resourceFile = $resourceNode->getResourceFile(); @@ -797,7 +797,7 @@ abstract class ResourceRepository extends ServiceEntityRepository $slug = $this->slugify->slugify($resourceName); } else { $originalExtension = pathinfo($resourceName, PATHINFO_EXTENSION); - $originalBasename = \basename($resourceName, $originalExtension); + $originalBasename = basename($resourceName, $originalExtension); $slug = sprintf('%s.%s', $this->slugify->slugify($originalBasename), $originalExtension); } diff --git a/src/CoreBundle/Repository/SequenceResourceRepository.php b/src/CoreBundle/Repository/SequenceResourceRepository.php index bd187e3926..31ae37aa60 100644 --- a/src/CoreBundle/Repository/SequenceResourceRepository.php +++ b/src/CoreBundle/Repository/SequenceResourceRepository.php @@ -280,7 +280,7 @@ class SequenceResourceRepository extends ServiceEntityRepository if (!$status) { $sessionsInCourse = SessionManager::get_session_by_course($id); foreach ($sessionsInCourse as $session) { - if (in_array($session['id'], $sessionUserList, true)) { + if (\in_array($session['id'], $sessionUserList, true)) { $status = $this->checkCourseRequirements($userId, $resource, $session['id']); if ($status) { break; diff --git a/src/CoreBundle/Security/Authorization/Voter/CourseVoter.php b/src/CoreBundle/Security/Authorization/Voter/CourseVoter.php index efc214d5ea..4db4fc59b3 100644 --- a/src/CoreBundle/Security/Authorization/Voter/CourseVoter.php +++ b/src/CoreBundle/Security/Authorization/Voter/CourseVoter.php @@ -43,7 +43,7 @@ class CourseVoter extends Voter ]; // if the attribute isn't one we support, return false - if (!in_array($attribute, $options, true)) { + if (!\in_array($attribute, $options, true)) { return false; } // only vote on Post objects inside this voter diff --git a/src/CoreBundle/Security/Authorization/Voter/GroupVoter.php b/src/CoreBundle/Security/Authorization/Voter/GroupVoter.php index 42cb44c0b1..1f2b3f10af 100644 --- a/src/CoreBundle/Security/Authorization/Voter/GroupVoter.php +++ b/src/CoreBundle/Security/Authorization/Voter/GroupVoter.php @@ -44,7 +44,7 @@ class GroupVoter extends Voter self::DELETE, ]; - return $subject instanceof CGroup && in_array($attribute, $options, true); + return $subject instanceof CGroup && \in_array($attribute, $options, true); } protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token): bool diff --git a/src/CoreBundle/Security/Authorization/Voter/ResourceNodeVoter.php b/src/CoreBundle/Security/Authorization/Voter/ResourceNodeVoter.php index 5ad8b365ff..aee20095cc 100644 --- a/src/CoreBundle/Security/Authorization/Voter/ResourceNodeVoter.php +++ b/src/CoreBundle/Security/Authorization/Voter/ResourceNodeVoter.php @@ -79,7 +79,7 @@ class ResourceNodeVoter extends Voter error_log('resourceNode supports'); // if the attribute isn't one we support, return false - if (!in_array($attribute, $options, true)) { + if (!\in_array($attribute, $options, true)) { return false; } // only vote on ResourceNode objects inside this voter diff --git a/src/CoreBundle/Security/Authorization/Voter/ResourceVoter.php b/src/CoreBundle/Security/Authorization/Voter/ResourceVoter.php index 95b3eb39aa..e7645a0d4f 100644 --- a/src/CoreBundle/Security/Authorization/Voter/ResourceVoter.php +++ b/src/CoreBundle/Security/Authorization/Voter/ResourceVoter.php @@ -66,7 +66,7 @@ class ResourceVoter extends Voter //error_log('resource supports'); // if the attribute isn't one we support, return false - if (!in_array($attribute, $options, true)) { + if (!\in_array($attribute, $options, true)) { return false; } diff --git a/src/CoreBundle/Security/Authorization/Voter/SessionVoter.php b/src/CoreBundle/Security/Authorization/Voter/SessionVoter.php index a88f82309e..c9e7d2f54f 100644 --- a/src/CoreBundle/Security/Authorization/Voter/SessionVoter.php +++ b/src/CoreBundle/Security/Authorization/Voter/SessionVoter.php @@ -53,7 +53,7 @@ class SessionVoter extends Voter self::DELETE, ]; - return $subject instanceof Session && in_array($attribute, $options, true); + return $subject instanceof Session && \in_array($attribute, $options, true); } /** @@ -159,7 +159,7 @@ class SessionVoter extends Voter // If there is a session duration but there is no previous // access by the user, then the session is still available - if (0 === count($courseAccess)) { + if (0 === \count($courseAccess)) { return true; } diff --git a/src/CoreBundle/Settings/SettingsManager.php b/src/CoreBundle/Settings/SettingsManager.php index 44fdee8dc7..c3442d61f9 100644 --- a/src/CoreBundle/Settings/SettingsManager.php +++ b/src/CoreBundle/Settings/SettingsManager.php @@ -193,7 +193,7 @@ class SettingsManager implements SettingsManagerInterface $settings = new Settings(); $parameters = isset($all[$name]) ? $all[$name] : []; foreach ($settingsBuilder->getTransformers() as $parameter => $transformer) { - if (array_key_exists($parameter, $parameters)) { + if (\array_key_exists($parameter, $parameters)) { if ('course_creation_use_template' === $parameter) { if (empty($parameters[$parameter])) { $parameters[$parameter] = null; @@ -243,7 +243,7 @@ class SettingsManager implements SettingsManagerInterface } foreach ($settingsBuilder->getTransformers() as $parameter => $transformer) { - if (array_key_exists($parameter, $parameters)) { + if (\array_key_exists($parameter, $parameters)) { if ('course_creation_use_template' === $parameter) { if (empty($parameters[$parameter])) { $parameters[$parameter] = null; @@ -276,7 +276,7 @@ class SettingsManager implements SettingsManagerInterface // 3. Add transformer for that variable "ArrayToIdentifierTransformer" // 4. Here we recover the transformer and convert the array to string foreach ($settingsBuilder->getTransformers() as $parameter => $transformer) { - if (array_key_exists($parameter, $parameters)) { + if (\array_key_exists($parameter, $parameters)) { $parameters[$parameter] = $transformer->transform($parameters[$parameter]); } } @@ -344,7 +344,7 @@ class SettingsManager implements SettingsManagerInterface // 3. Add transformer for that variable "ArrayToIdentifierTransformer" // 4. Here we recover the transformer and convert the array to string foreach ($settingsBuilder->getTransformers() as $parameter => $transformer) { - if (array_key_exists($parameter, $parameters)) { + if (\array_key_exists($parameter, $parameters)) { $parameters[$parameter] = $transformer->transform($parameters[$parameter]); } } diff --git a/src/CoreBundle/ToolChain.php b/src/CoreBundle/ToolChain.php index 052d261490..ea6d8fe24c 100644 --- a/src/CoreBundle/ToolChain.php +++ b/src/CoreBundle/ToolChain.php @@ -192,7 +192,7 @@ class ToolChain /** @var AbstractTool $tool */ foreach ($tools as $tool) { - $visibility = in_array($tool->getName(), $toolVisibility, true); + $visibility = \in_array($tool->getName(), $toolVisibility, true); $criteria = [ 'name' => $tool->getName(), ]; @@ -225,7 +225,7 @@ class ToolChain { $tools = $this->getTools(); - if (array_key_exists($name, $tools)) { + if (\array_key_exists($name, $tools)) { return $tools[$name]; } diff --git a/src/CoreBundle/Transformer/ArrayToIdentifierTransformer.php b/src/CoreBundle/Transformer/ArrayToIdentifierTransformer.php index 805d336673..0d67c9c83c 100644 --- a/src/CoreBundle/Transformer/ArrayToIdentifierTransformer.php +++ b/src/CoreBundle/Transformer/ArrayToIdentifierTransformer.php @@ -17,7 +17,7 @@ class ArrayToIdentifierTransformer implements DataTransformerInterface { public function transform($value) { - if (!is_array($value)) { + if (!\is_array($value)) { return ''; } diff --git a/src/CourseBundle/Entity/CQuiz.php b/src/CourseBundle/Entity/CQuiz.php index 29c2e20ce2..ef906d5e25 100644 --- a/src/CourseBundle/Entity/CQuiz.php +++ b/src/CourseBundle/Entity/CQuiz.php @@ -774,7 +774,7 @@ class CQuiz extends AbstractResource implements ResourceInterface return $this->hideQuestionNumber; } - public function setHideQuestionNumber(int $hideQuestionNumber): CQuiz + public function setHideQuestionNumber(int $hideQuestionNumber): self { $this->hideQuestionNumber = $hideQuestionNumber; diff --git a/src/CourseBundle/Entity/CShortcut.php b/src/CourseBundle/Entity/CShortcut.php index b2001a682c..11e17099eb 100644 --- a/src/CourseBundle/Entity/CShortcut.php +++ b/src/CourseBundle/Entity/CShortcut.php @@ -42,8 +42,8 @@ class CShortcut extends AbstractResource implements ResourceInterface protected ResourceNode $shortCutNode; /** - * @Groups({"cshortcut:read"}) - */ + * @Groups({"cshortcut:read"}) + */ protected string $url; /** @@ -68,8 +68,7 @@ class CShortcut extends AbstractResource implements ResourceInterface public function getUrl() { - return - '/r/'.$this->getShortCutNode()->getResourceType()->getTool()->getName(). + return '/r/'.$this->getShortCutNode()->getResourceType()->getTool()->getName(). '/'.$this->getShortCutNode()->getResourceType()->getName(). '/'.$this->getShortCutNode()->getId(). '/link'; diff --git a/src/CourseBundle/Settings/SettingsCourseManager.php b/src/CourseBundle/Settings/SettingsCourseManager.php index 285ae0b61a..57c75f5c9c 100644 --- a/src/CourseBundle/Settings/SettingsCourseManager.php +++ b/src/CourseBundle/Settings/SettingsCourseManager.php @@ -60,7 +60,7 @@ class SettingsCourseManager extends SettingsManager } foreach ($settingsBuilder->getTransformers() as $parameter => $transformer) { - if (array_key_exists($parameter, $parameters)) { + if (\array_key_exists($parameter, $parameters)) { $parameters[$parameter] = $transformer->reverseTransform($parameters[$parameter]); } } @@ -88,7 +88,7 @@ class SettingsCourseManager extends SettingsManager // 3. Add transformer for that variable "ArrayToIdentifierTransformer" // 4. Here we recover the transformer and convert the array to string foreach ($settingsBuilder->getTransformers() as $parameter => $transformer) { - if (array_key_exists($parameter, $parameters)) { + if (\array_key_exists($parameter, $parameters)) { $parameters[$parameter] = $transformer->transform($parameters[$parameter]); } }