Source code should not contain TODO comments 12

  • Minor
  • Architecture

More information: https://insight.symfony.com/what-we-analyse/task_todo_comment

  1. // PHPIDS should run with PHP 5.1.2 but this is untested - set this value to force compatibilty with minor versions
  2. $config['General']['min_php_version'] = '5.1.6';
  3. // caching settings
  4. // @todo: add UI for those caching settings

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Drak
  5. $config['Caching'] = [];
  6. // caching method (session|file|database|memcached|none), default file
  7. $config['Caching']['caching'] = 'none'; // deactivate caching for now
  8. $config['Caching']['expiration_time'] = 600;
  1. *
  2. * @return boolean true if category may be deleted or moved, false otherwise
  3. */
  4. public function mayCategoryBeDeletedOrMoved(CategoryEntity $category)
  5. {
  6. // TODO #3920

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Guite
  7. return true;
  8. // collect parents
  9. $isOnTop = false;
  10. $parentIds = [$category->getId()];
in src/lib/bootstrap.php, line 41
  1. \Locale::setDefault($parameters['locale']);
  2. if (version_compare(PHP_VERSION, '7.2.0') >= 0) {
  3. // suppress deprecated warnings because create_function() is used in SymfonyRequirements.php but deprecated in PHP 7.2
  4. // see https://github.com/symfony/requirements-checker/pull/11
  5. // TODO remove as soon as we use Flex

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Axel Guckelsberger
  6. $reportingLevel = error_reporting();
  7. error_reporting($reportingLevel & ~E_DEPRECATED);
  8. }
  9. // on install or upgrade, check if system requirements are met.
in src/lib/bootstrap.php, line 51
  1. // on install or upgrade, check if system requirements are met.
  2. $requirementChecker = new RequirementChecker();
  3. $requirementChecker->verify($parameters);
  4. if (version_compare(PHP_VERSION, '7.2.0') >= 0) {
  5. // TODO remove as soon as we use Flex

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Axel Guckelsberger
  6. error_reporting($reportingLevel);
  7. }
  8. $kernel = new ZikulaKernel($parameters['env'], $parameters['debug']);
  9. $kernel->boot();
  1. public function runSymfonyChecks($parameters = [])
  2. {
  3. if (version_compare(PHP_VERSION, '7.2.0') >= 0) {
  4. // suppress deprecated warnings because create_function() is used in SymfonyRequirements.php but deprecated in PHP 7.2
  5. // see https://github.com/symfony/requirements-checker/pull/11
  6. // TODO remove as soon as we use Flex

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Axel Guckelsberger
  7. $reportingLevel = error_reporting();
  8. error_reporting($reportingLevel & ~E_DEPRECATED);
  9. }
  10. try {
  1. } catch (MethodArgumentValueNotImplementedException $e) {
  2. // workaround https://github.com/symfony/symfony-installer/issues/163
  3. }
  4. if (version_compare(PHP_VERSION, '7.2.0') >= 0) {
  5. // TODO remove as soon as we use Flex

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Axel Guckelsberger
  6. error_reporting($reportingLevel);
  7. }
  8. }
  9. protected function getErrorMessage(\Requirement $requirement, $lineSize = 70)
  1. {% endfor %}
  2. </tbody>
  3. </table>
  4. {{ pager({rowcount:pager.count, limit:pager.limit, route:'zikulaextensionsmodule_module_viewmodulelist'}) }}
  5. {{ adminFooter() }}
  6. {# todo move to own file #}

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Guite
  7. {% set initScript %}
  8. <script>
  9. ( function($) {
  10. $(document).ready(function() {
  11. $('i[class*=fa-caret-]').on('click', function() {
  1. {{ adminHeader() }}{# @todo wrong header! see below #}

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Craig Heydenburg
  2. {#{admincategorymenu}#}
  3. {#<div class="z-admin-content clearfix">#}
  4. {#{modgetinfo modname=$currentmodule info='displayname' assign='displayName'}#}
  5. {#{modgetimage modname=$currentmodule assign='image'}#}
  1. }
  2. if ('Filter' == $namespace) {
  3. if (
  4. // Do not allow Filter.Custom for now. Causing errors.
  5. // TODO research why Filter.Custom is causing exceptions and correct.

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Axel Guckelsberger
  6. ('Custom' == $directive)
  7. // Do not allow Filter.ExtractStyleBlock* for now. Causing errors.
  8. // TODO Filter.ExtractStyleBlock* requires CSSTidy
  9. || (false !== stripos($directive, 'ExtractStyleBlock'))
  10. ) {
  1. if (
  2. // Do not allow Filter.Custom for now. Causing errors.
  3. // TODO research why Filter.Custom is causing exceptions and correct.
  4. ('Custom' == $directive)
  5. // Do not allow Filter.ExtractStyleBlock* for now. Causing errors.
  6. // TODO Filter.ExtractStyleBlock* requires CSSTidy

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Axel Guckelsberger
  7. || (false !== stripos($directive, 'ExtractStyleBlock'))
  8. ) {
  9. continue;
  10. }
  11. }
  1. */
  2. public function getBrowserLocale($default = 'en')
  3. {
  4. $request = null !== $this->requestStack ? $this->requestStack->getCurrentRequest() : null;
  5. // @todo consider http://php.net/manual/en/locale.acceptfromhttp.php and http://php.net/manual/en/locale.lookup.php

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Craig Heydenburg
  6. if (null === $request || !$request->server->has('HTTP_ACCEPT_LANGUAGE') || 'cli' == php_sapi_name()) {
  7. return $default;
  8. }
  9. preg_match_all('~([\w-]+)(?:[^,\d]+([\d.]+))?~', strtolower($request->server->get('HTTP_ACCEPT_LANGUAGE')), $matches, PREG_SET_ORDER);
  10. $availableLanguages = [];
  1. if (false === $data['multilingual']) {
  2. $data['language_detect'] = false;
  3. $this->get('zikula_extensions_module.api.variable')->del(VariableApi::CONFIG, 'language');
  4. }
  5. $this->setSystemVars($data);
  6. $this->get('zikula_extensions_module.api.variable')->set(VariableApi::CONFIG, 'locale', $data['language_i18n']); // @todo which variable are we using?

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. $this->get('zikula_routes_module.multilingual_routing_helper')->reloadMultilingualRoutingSettings(); // resets config/dynamic/generated.yml & custom_parameters.yml
  8. $request->getSession()->set('_locale', $data['language_i18n']);
  9. $this->addFlash('status', $this->__('Done! Localization configuration updated.'));
  10. }

Code should not be duplicated 10

  • Minor
  • Architecture

More information: https://insight.symfony.com/what-we-analyse/php.duplicated_code

  1. if ($currentStage instanceof WizardCompleteInterface) {
  2. return $currentStage->getResponse($request);
  3. }
  4. $templateParams = $this->controllerHelper->getTemplateGlobals($currentStage);
  5. $templateParams['headertemplate'] = '@ZikulaCoreInstaller/installheader.html.twig';
  6. if ($wizard->isHalted()) {

    The next 14 lines appear both in src/lib/Zikula/Bundle/CoreInstallerBundle/Controller/InstallerController.php:58 and src/lib/Zikula/Bundle/CoreInstallerBundle/Controller/UpgraderController.php:66.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. $request->getSession()->getFlashBag()->add('danger', $wizard->getWarning());
  8. return $this->renderResponse('ZikulaCoreInstallerBundle::error.html.twig', $templateParams);
  9. }
  1. /**
  2. * Get id
  3. *
  4. * @return integer
  5. */
  6. public function getId()

    The next 104 lines appear both in src/lib/Zikula/Bundle/HookBundle/Dispatcher/Storage/Doctrine/Entity/HookBindingEntity.php:81 and src/lib/Zikula/Bundle/HookBundle/Dispatcher/Storage/Doctrine/Entity/HookRuntimeEntity.php:102.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Drak
  7. {
  8. return $this->id;
  9. }
  10. /**
  1. public function buildForm(FormBuilderInterface $builder, array $options)
  2. {
  3. $translator = $options['translator'];
  4. $builder
  5. ->add('name', TextType::class, [

    The next 40 lines appear both in src/system/AdminModule/Form/Type/CreateCategoryType.php:35 and src/system/AdminModule/Form/Type/EditCategoryType.php:37.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Axel Guckelsberger
  6. 'label' => $translator->__('Name'),
  7. 'attr' => [
  8. 'maxlength' => 50
  9. ]
  10. ])
  1. *
  2. * For the full copyright and license information, please view the LICENSE
  3. * file that was distributed with this source code.
  4. */
  5. namespace Zikula\BlocksModule\Container;

    The next 69 lines appear in src/system/BlocksModule/Container/LinkContainer.php:12, src/system/MailerModule/Container/LinkContainer.php:12 and src/system/ThemeModule/Container/LinkContainer.php:12.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Craig Heydenburg
  6. use Symfony\Component\Routing\RouterInterface;
  7. use Zikula\Common\Translator\TranslatorInterface;
  8. use Zikula\Core\LinkContainer\LinkContainerInterface;
  9. use Zikula\PermissionsModule\Api\ApiInterface\PermissionApiInterface;
  1. *
  2. * For the full copyright and license information, please view the LICENSE
  3. * file that was distributed with this source code.
  4. */
  5. namespace Zikula\BlocksModule\Container;

    The next 64 lines appear in src/system/BlocksModule/Container/LinkContainer.php:12, src/system/ExtensionsModule/Container/LinkContainer.php:12 and src/system/PermissionsModule/Container/LinkContainer.php:12.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Craig Heydenburg
  6. use Symfony\Component\Routing\RouterInterface;
  7. use Zikula\Common\Translator\TranslatorInterface;
  8. use Zikula\Core\LinkContainer\LinkContainerInterface;
  9. use Zikula\PermissionsModule\Api\ApiInterface\PermissionApiInterface;
  1. *
  2. * For the full copyright and license information, please view the LICENSE
  3. * file that was distributed with this source code.
  4. */
  5. namespace Zikula\BlocksModule\Container;

    The next 66 lines appear both in src/system/BlocksModule/Container/LinkContainer.php:12 and src/system/MenuModule/Container/LinkContainer.php:12.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Craig Heydenburg
  6. use Symfony\Component\Routing\RouterInterface;
  7. use Zikula\Common\Translator\TranslatorInterface;
  8. use Zikula\Core\LinkContainer\LinkContainerInterface;
  9. use Zikula\PermissionsModule\Api\ApiInterface\PermissionApiInterface;
  1. *
  2. * For the full copyright and license information, please view the LICENSE
  3. * file that was distributed with this source code.
  4. */
  5. namespace Zikula\GroupsModule\Form\Type;

    The next 32 lines appear both in src/system/GroupsModule/Form/Type/ConfigType.php:12 and src/system/SearchModule/Form/Type/ConfigType.php:12.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Axel Guckelsberger
  6. use Symfony\Component\Form\AbstractType;
  7. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  8. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  9. use Symfony\Component\Form\Extension\Core\Type\IntegerType;
  1. $groupsCommon = new CommonHelper($translator);
  2. $typeChoices = array_flip($groupsCommon->gtypeLabels());
  3. $stateChoices = array_flip($groupsCommon->stateLabels());
  4. $builder
  5. ->add('name', TextType::class, [

    The next 25 lines appear both in src/system/GroupsModule/Form/Type/CreateGroupType.php:44 and src/system/GroupsModule/Form/Type/EditGroupType.php:46.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Axel Guckelsberger
  6. 'label' => $translator->__('Name'),
  7. 'attr' => [
  8. 'maxlength' => 30
  9. ],
  10. 'constraints' => [
  1. }
  2. /**
  3. * {@inheritdoc}
  4. */
  5. public function getResults($filters = [], $sorting = [], $limit = 0, $offset = 0)

    The next 33 lines appear both in src/system/SearchModule/Entity/Repository/SearchResultRepository.php:48 and src/system/SearchModule/Entity/Repository/SearchStatRepository.php:43.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Guite
  6. {
  7. $qb = $this->createQueryBuilder('tbl')
  8. ->select('tbl');
  9. // add clauses for where
  1. *
  2. * For the full copyright and license information, please view the LICENSE
  3. * file that was distributed with this source code.
  4. */
  5. namespace Zikula\UsersModule\Validator\Constraints;

    The next 64 lines appear both in src/system/UsersModule/Validator/Constraints/ValidEmailValidator.php:12 and src/system/ZAuthModule/Validator/Constraints/ValidEmailValidator.php:12.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Craig Heydenburg
  6. use Symfony\Component\Validator\Constraint;
  7. use Symfony\Component\Validator\Constraints\Email;
  8. use Symfony\Component\Validator\ConstraintValidator;
  9. use Symfony\Component\Validator\ConstraintViolationListInterface;

Error silenced by the at sign (@)

  • Minor
  • Bugrisk

More information: https://insight.symfony.com/what-we-analyse/php.silenced_error

  1. return;
  2. }
  3. private function isSerialized($string)
  4. {
  5. return 'b:0;' === $string || false !== @unserialize($string);

    Adding "@" before unserialize($string) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Axel Guckelsberger
  6. }
  7. }

Form types should be in Form folders

  • Minor
  • Codestyle

More information: https://insight.symfony.com/what-we-analyse/symfony.form.form_type_not_in_type_form_folder

A form type has been found outside Form folder

Time to fix: about 2 hours
Open Issue Permalink
Last edited by Guite
  • src/lib/Zikula/Common/Content
    • AbstractContentFormType.php

      A form type has been found outside Form folder

    • AbstractContentType.php
    • ContentTypeInterface.php

Commented code should not be committed 10

  • Minor
  • Deadcode

More information: https://insight.symfony.com/what-we-analyse/php.commented_out_code

  1. }
  2. $response = $event->getResponse();
  3. $response->headers->set('X-Frame-Options', $this->xFrameOptions);
  4. //$response->headers->set('X-Content-Security-Policy', "frame-ancestors 'self'");

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Open Issue Permalink
    Last edited by Guite
  5. $response->headers->set('X-XSS-Protection', '1');
  6. }
  7. }
  1. if ($this->csrfToken) {
  2. $core['authid'] = $this->authid;
  3. $core['token'] = $this->csrfToken;
  4. }
  5. //$logUtilMessages = (array) \LogUtil::getStatusMessages();

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Open Issue Permalink
    Last edited by Drak
  6. //$core['statusmsg'] = array_merge($this->messages, $logUtilMessages);
  7. $core['statusmsg'] = $this->messages;
  8. return $core;
  9. }
  1. if ($this->csrfToken) {
  2. $core['authid'] = $this->authid;
  3. $core['token'] = $this->csrfToken;
  4. }
  5. //$logUtilMessages = (array) \LogUtil::getStatusMessages();
  6. //$core['statusmsg'] = array_merge($this->messages, $logUtilMessages);

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Open Issue Permalink
    Last edited by Drak
  7. $core['statusmsg'] = $this->messages;
  8. return $core;
  9. }
  1. $event = new ModuleStateEvent($bundle, $extensionEntity->toArray());
  2. $this->get('event_dispatcher')->dispatch(CoreEvents::MODULE_POSTINSTALL, $event);
  3. }
  4. }
  5. // currently commented out because it takes a long time.
  6. // $this->get('zikula_extensions_module.extension_helper')->installAssets();

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. }
  8. return $this->redirectToRoute('zikulaextensionsmodule_module_viewmodulelist', ['justinstalled' => json_encode($extensions)]);
  9. }
  1. $logger->addError("Could not send message to: $emailList :: " . $this->message->toString());
  2. }
  3. $this->eventDispatcher->dispatch(MailerEvents::SEND_MESSAGE_FAILURE, $event);
  4. //throw new \RuntimeException($this->__('Error! A problem occurred while sending the e-mail message.'));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Open Issue Permalink
    Last edited by Axel Guckelsberger
  5. return false;
  6. }
  7. if ($this->dataValues['enableLogging']) {
  1. * MenuItemEntity constructor.
  2. */
  3. public function __construct()
  4. {
  5. $this->title = '';
  6. $this->options = []; /*new ArrayCollection();

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Open Issue Permalink
    Last edited by Guite
  7. $this->options = [
  8. 'routeParameters' => [],
  9. 'attributes' => [],
  10. 'linkAttributes' => [],
  11. 'childrenAttributes' => [],
  1. $record['level'] = ACCESS_COMMENT; // 300
  2. $record['bond'] = 0;
  3. $this->entityManager->persist($record);
  4. $lastPerm->setSequence($record->getSequence() + 1);
  5. $this->entityManager->flush();
  6. //$this->addFlash('success', $this->__('A permission rule was added to allow users access to "utility" themes. Please check the sequence.'));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Open Issue Permalink
    Last edited by Guite
  7. case '1.1.2':
  8. // future upgrade routines
  9. }
  1. if ($multilingual) {
  2. // get all available locales
  3. $langs = $installedLanguages;
  4. } else {
  5. // get only the default locale
  6. $langs = [$variableApi->getSystemVar('language_i18n', 'en')]; //$this->container->getParameter('locale');

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. }
  8. }
  9. $errors = '';
  1. if ($request->server->has('USER_AGENT')) {
  2. $requestArgs['USER_AGENT'] = $request->server->get('USER_AGENT');
  3. }
  4. // while i think that REQUEST_URI is unnecessary,
  5. // the REFERER would be important, but results in way too many false positives
  6. /*

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Open Issue Permalink
    Last edited by Axel Guckelsberger
  7. if ($request->server->has('REQUEST_URI')) {
  8. $requestArgs['REQUEST_URI'] = $request->server->get('REQUEST_URI');
  9. }
  10. if ($request->server->has('HTTP_REFERER')) {
  11. $requestArgs['REFERER'] = $request->server->get('HTTP_REFERER');
  1. $config['General']['filter_type'] = $this->getSystemVar('idsfilter', 'xml');
  2. if (empty($config['General']['filter_type'])) {
  3. $config['General']['filter_type'] = 'xml';
  4. }
  5. $config['General']['base_path'] = ''; //PHPIDS_PATH_PREFIX;

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  6. // we don't use the base path because the tmp directory is in zkTemp (see below)
  7. $config['General']['use_base_path'] = false;
  8. // path to the filters used
  9. $config['General']['filter_path'] = $this->getSystemVar('idsrulepath', 'system/SecurityCenterModule/Resources/config/phpids_zikula_default.xml');

PHP code should not contain unreachable code

  • Minor
  • Deadcode

More information: https://insight.symfony.com/what-we-analyse/php.unreachable_code

  1. {
  2. // TODO #3920
  3. return true;
  4. // collect parents
  5. $isOnTop = false;
  6. $parentIds = [$category->getId()];
  7. $directParent = $category;
  8. while (false === $isOnTop) {
  9. $directParent = $category->getParent();
  10. if (null === $directParent) {
  11. $isOnTop = true;
  12. } else {
  13. $parentIds[] = $directParent->getId();
  14. }
  15. }
  16. // fetch registries
  17. $registries = $this->entityManager->getRepository('ZikulaCategoriesModule:CategoryRegistryEntity')
  18. ->findAll();
  19. // iterate over all registries
  20. foreach ($registries as $registry) {
  21. // check if the registry subtree contains our category
  22. if (!in_array($registry->getCategory()->getId(), $parentIds)) {
  23. continue;
  24. }
  25. // get information about responsible module
  26. if (!$this->kernel->isBundle($registry->getModname())) {
  27. continue;
  28. }
  29. $capabilities = $this->capabilityApi->getCapabilitiesOf($registry->getModname());
  30. foreach ($capabilities[CapabilityApi::CATEGORIZABLE] as $entityClass) {
  31. if (!is_subclass_of($entityClass, 'Zikula\\CategoriesModule\\Entity\\AbstractCategoryAssignment')) {
  32. continue;
  33. }
  34. // check if this mapping table contains a reference to the given category
  35. $mappings = $this->entityManager->getRepository($entityClass)
  36. ->findBy(['category' => $category]);
  37. if (count($mappings) > 0) {
  38. // existing reference found
  39. return false;
  40. }
  41. }
  42. }
  43. return true;

    This code is unreachable.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Guite
  44. }
  45. }

Unused method, property, variable or parameter 4

  • Minor
  • Deadcode

More information: https://insight.symfony.com/what-we-analyse/php.unused_local_variable_or_private_member

  1. * @param string $context Usage context (allowed values: controllerAction, api, actionHandler, block, contentType)
  2. * @param array $args Additional arguments
  3. *
  4. * @return array List of template variables to be assigned
  5. */
  6. protected function getViewQuickNavParametersForRoute($context = '', array $args = [])

    This args argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Axel Guckelsberger
  7. {
  8. $parameters = [];
  9. if (null === $this->request) {
  10. return $parameters;
  11. }
  1. * @param string $context Usage context (allowed values: controllerAction, api, actionHandler, block, contentType)
  2. * @param array $args Additional arguments
  3. *
  4. * @return array List of template variables to be assigned
  5. */
  6. protected function getViewQuickNavParametersForRoute($context = '', array $args = [])

    This context argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Axel Guckelsberger
  7. {
  8. $parameters = [];
  9. if (null === $this->request) {
  10. return $parameters;
  11. }
  1. * @param QueryBuilder $qb Query builder to be enhanced
  2. * @param array $parameters List of determined filter options
  3. *
  4. * @return QueryBuilder Enriched query builder instance
  5. */
  6. protected function applyDefaultFiltersForRoute(QueryBuilder $qb, array $parameters = [])

    This parameters argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Axel Guckelsberger
  7. {
  8. if (null === $this->request) {
  9. return $qb;
  10. }
  11. $routeName = $this->request->get('_route');
  1. $permissionApi = $this->container->get('zikula_permissions_module.api.permission');
  2. $currentUserApi = $this->container->get('zikula_users_module.current_user');
  3. $entityDisplayHelper = $this->container->get('zikula_routes_module.entity_display_helper');
  4. $menu->setChildrenAttribute('class', 'list-inline');
  5. $currentUserId = $currentUserApi->isLoggedIn() ? $currentUserApi->get('uid') : UsersConstant::USER_ID_ANONYMOUS;

    This currentUserId local variable is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Axel Guckelsberger
  6. if ($entity instanceof RouteEntity) {
  7. $component = 'ZikulaRoutesModule:Route:';
  8. $instance = $entity->getKey() . '::';
  9. $routePrefix = 'zikularoutesmodule_route_';

Deprecated class usage found 3

  • Info
  • Architecture

More information: https://insight.symfony.com/what-we-analyse/third_party.use_deprecated_class

  1. /**
  2. * Dispatcher instance.
  3. *
  4. * @var EventDispatcher
  5. */
  6. protected $dispatcher;

    The Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher class has been deprecated in Symfony 3.3. Use the Symfony\Component\EventDispatcher\EventDispatcher class instead.

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Drak
  7. /**
  8. * Translation domain.
  9. *
  10. * @var string
  1. /**
  2. * Constructor.
  3. *
  4. * @param EventDispatcher $dispatcher ServiceManager
  5. */
  6. public function __construct(EventDispatcherInterface $dispatcher)

    The Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher class has been deprecated in Symfony 3.3. Use the Symfony\Component\EventDispatcher\EventDispatcher class instead.

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Drak
  7. {
  8. $this->dispatcher = $dispatcher;
  9. $this->setTranslator($dispatcher->getContainer()->get('translator.default'));
  10. $this->setup();
  11. if (null !== $this->domain) {
  1. /**
  2. * Get dispatcher.
  3. *
  4. * @return EventDispatcher
  5. */
  6. public function getDispatcher()

    The Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher class has been deprecated in Symfony 3.3. Use the Symfony\Component\EventDispatcher\EventDispatcher class instead.

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Drak
  7. {
  8. return $this->dispatcher;
  9. }
  10. /**

PHP code should follow PSR-1 basic coding standard 44

  • Info
  • Codestyle

More information: https://insight.symfony.com/what-we-analyse/php.psr1

  1. /**
  2. * get the category locked status
  3. *
  4. * @return bool locked status flag
  5. */
  6. public function getIs_locked()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Drak
  7. {
  8. return $this->is_locked;
  9. }
  10. /**
  1. /**
  2. * get the category locked status
  3. *
  4. * @param bool $is_locked locked status flag
  5. */
  6. public function setIs_locked($is_locked)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Drak
  7. {
  8. $this->is_locked = $is_locked;
  9. }
  10. /**
  1. /**
  2. * get the category leaf status
  3. *
  4. * @return bool leaf status flag
  5. */
  6. public function getIs_leaf()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Drak
  7. {
  8. return $this->is_leaf;
  9. }
  10. /**
  1. /**
  2. * set the category leaf status
  3. *
  4. * @param bool $is_leaf leaft status flag
  5. */
  6. public function setIs_leaf($is_leaf)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Drak
  7. {
  8. $this->is_leaf = $is_leaf;
  9. }
  10. /**
  1. * get the category display name
  2. * @param $lang
  3. *
  4. * @return array|string the category display name(s)
  5. */
  6. public function getDisplay_name($lang = null)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. if (!empty($lang)) {
  9. if (isset($this->display_name[$lang])) {
  10. return $this->display_name[$lang];
  11. }
  1. /**
  2. * set the category display name
  3. *
  4. * @param array $display_name the category display name array
  5. */
  6. public function setDisplay_name($display_name)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. $this->display_name = $display_name;
  9. }
  10. /**
  1. * get the category display description
  2. * @param $lang
  3. *
  4. * @return array|string the category display description
  5. */
  6. public function getDisplay_desc($lang = null)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. if (!empty($lang)) {
  9. if (isset($this->display_desc[$lang])) {
  10. return $this->display_desc[$lang];
  11. }
  1. /**
  2. * set the category display description
  3. *
  4. * @param array $display_desc the category display description
  5. */
  6. public function setDisplay_desc($display_desc)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. $this->display_desc = $display_desc;
  9. }
  10. /**
  1. /**
  2. * set the creation date of the category
  3. *
  4. * @param mixed $cr_date the creation date
  5. */
  6. public function setCr_date($cr_date)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. $this->cr_date = $cr_date;
  9. }
  10. /**
  1. /**
  2. * get the creation date of the category
  3. *
  4. * @return mixed the creation date
  5. */
  6. public function getCr_date()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. return $this->cr_date;
  9. }
  10. /**
  1. /**
  2. * set the creation user id of the category
  3. *
  4. * @param int $cr_uid the user id
  5. */
  6. public function setCr_uid($cr_uid)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. $this->cr_uid = $cr_uid;
  9. }
  10. /**
  1. /**
  2. * get the creation user id
  3. *
  4. * @return int the user id
  5. */
  6. public function getCr_uid()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. return $this->cr_uid;
  9. }
  10. /**
  1. /**
  2. * set the last updated timestamp of the category
  3. *
  4. * @param mixed $lu_date the last updated timestamp
  5. */
  6. public function setLu_date($lu_date)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. $this->lu_date = $lu_date;
  9. }
  10. /**
  1. /**
  2. * get the last updated timestamp of the category
  3. *
  4. * @return mixed the last updated timestamp
  5. */
  6. public function getLu_date()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. return $this->lu_date;
  9. }
  10. /**
  1. /**
  2. * set the user id of the user who last updated the category
  3. *
  4. * @param int $lu_uid the user id
  5. */
  6. public function setLu_uid($lu_uid)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. $this->lu_uid = $lu_uid;
  9. }
  10. /**
  1. /**
  2. * get the user id of the user who last updated the category
  3. *
  4. * @return int the user id
  5. */
  6. public function getLu_uid()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. return $this->lu_uid;
  9. }
  10. /**
  1. * @param string $m2 Plural instance
  2. * @param integer $n Object count
  3. * @param string| null $locale Optional forced locale
  4. * @return string
  5. */
  6. public function _n($m1, $m2, $n, $locale = null)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Guite
  7. {
  8. /** @Ignore */
  9. return $this->translator->_n($m1, $m2, $n, $this->domain, $locale);
  10. }
  1. * @param integer $n Object count
  2. * @param string|array $param Format parameters
  3. * @param string|null $locale Optional forced locale
  4. * @return string
  5. */
  6. public function _fn($m1, $m2, $n, $param, $locale = null)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Guite
  7. {
  8. /** @Ignore */
  9. return $this->translator->_fn($m1, $m2, $n, $param, $this->domain, $locale);
  10. }
  1. /**
  2. * get last update time of the block
  3. *
  4. * @return \DateTime the block's last updated time
  5. */
  6. public function getLast_Update()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. return $this->last_update;
  9. }
  10. /**
  1. /**
  2. * set the last updated time of the block
  3. *
  4. * @param none
  5. */
  6. public function setLast_Update()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. $this->last_update = new \DateTime("now");
  9. }
  10. /**
  1. /**
  2. * set the creation date
  3. *
  4. * @param mixed $cr_date the creation date
  5. */
  6. public function setCr_date($cr_date)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. $this->cr_date = $cr_date;
  9. }
  10. /**
  1. /**
  2. * get the creation date
  3. *
  4. * @return mixed the creation date
  5. */
  6. public function getCr_date()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. return $this->cr_date;
  9. }
  10. /**
  1. /**
  2. * set the creation user id
  3. *
  4. * @param mixed $cr_uid the user id
  5. */
  6. public function setCr_uid($cr_uid)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. $this->cr_uid = $cr_uid;
  9. }
  10. /**
  1. /**
  2. * get the creation user id
  3. *
  4. * @return int the user id
  5. */
  6. public function getCr_uid()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. return $this->cr_uid;
  9. }
  10. /**
  1. /**
  2. * set the last updated date
  3. *
  4. * @param mixed $lu_date the date of the last update
  5. */
  6. public function setLu_date($lu_date)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. $this->lu_date = $lu_date;
  9. }
  10. /**
  1. /**
  2. * get the last updated date
  3. *
  4. * @return mixed the date of the last update
  5. */
  6. public function getLu_date()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. return $this->lu_date;
  9. }
  10. /**
  1. /**
  2. * set the user id of the user who last updated the entity
  3. *
  4. * @param mixed $lu_uid the user id
  5. */
  6. public function setLu_uid($lu_uid)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. $this->lu_uid = $lu_uid;
  9. }
  10. /**
  1. /**
  2. * get the user id of the user who last updated the entity
  3. *
  4. * @return int the user id
  5. */
  6. public function getLu_uid()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. return $this->lu_uid;
  9. }
  10. /**
  1. /**
  2. * set the status of the entity
  3. *
  4. * @param string $obj_status the entity status
  5. */
  6. public function setObj_status($obj_status)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. $this->obj_status = $obj_status;
  9. }
  10. /**
  1. /**
  2. * get the status of the entity
  3. *
  4. * @return string the entity status
  5. */
  6. public function getObj_status()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. return $this->obj_status;
  9. }
  10. }
  1. public function setSecurityschema($securityschema)
  2. {
  3. $this->securityschema = $securityschema;
  4. }
  5. public function getCore_min()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Drak
  6. {
  7. return $this->core_min;
  8. }
  9. public function setCore_min($core_min)
  1. public function getCore_min()
  2. {
  3. return $this->core_min;
  4. }
  5. public function setCore_min($core_min)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Drak
  6. {
  7. $this->core_min = $core_min;
  8. }
  9. public function getCore_max()
  1. public function setCore_min($core_min)
  2. {
  3. $this->core_min = $core_min;
  4. }
  5. public function getCore_max()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Drak
  6. {
  7. return $this->core_max;
  8. }
  9. public function setCore_max($core_max)
  1. public function getCore_max()
  2. {
  3. return $this->core_max;
  4. }
  5. public function setCore_max($core_max)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Drak
  6. {
  7. $this->core_max = $core_max;
  8. }
  9. public function setCorecompatibility($coreCompatibility)
  1. /**
  2. * Returns the _object type.
  3. *
  4. * @return string
  5. */
  6. public function get_objectType()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Christian Flach
  7. {
  8. return $this->_objectType;
  9. }
  10. /**
  1. *
  2. * @param string $_objectType
  3. *
  4. * @return void
  5. */
  6. public function set_objectType($_objectType)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Christian Flach
  7. {
  8. if ($this->_objectType != $_objectType) {
  9. $this->_objectType = $_objectType;
  10. }
  11. }
  1. /**
  2. * get the approved date of the user
  3. *
  4. * @return \DateTime the user's approved date
  5. */
  6. public function getApproved_Date()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. return $this->approved_date;
  9. }
  10. /**
  1. /**
  2. * set the approved date for the user
  3. *
  4. * @param \DateTime $approved_date the user's approved date
  5. */
  6. public function setApproved_Date($approved_date)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. if ($approved_date instanceof \DateTime) {
  9. $this->approved_date = $approved_date;
  10. } else {
  11. // assume $approved_date is a string.
  1. /**
  2. * get the user id who approved the user
  3. *
  4. * @return integer the user's id who approved the user
  5. */
  6. public function getApproved_By()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. return $this->approved_by;
  9. }
  10. /**
  1. /**
  2. * set the user id who approved the user
  3. *
  4. * @param integer $approved_by the user's id who approved the user
  5. */
  6. public function setApproved_By($approved_by)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. $this->approved_by = $approved_by;
  9. }
  10. /**
  1. /**
  2. * get the regdate of the user
  3. *
  4. * @return \DateTime the user's regdate
  5. */
  6. public function getUser_Regdate()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. return $this->user_regdate;
  9. }
  10. /**
  1. /**
  2. * set the regdate for the user
  3. *
  4. * @param \DateTime $user_regdate the user's regdate
  5. */
  6. public function setUser_Regdate($user_regdate)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. {
  8. if ($user_regdate instanceof \DateTime) {
  9. $this->user_regdate = $user_regdate;
  10. } else {
  11. // assume $user_regdate is a string
  1. /**
  2. * get the created date of the user verification
  3. *
  4. * @return \DateTime the user verification's created date
  5. */
  6. public function getCreated_Dt()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Drak
  7. {
  8. return $this->created_dt;
  9. }
  10. /**
  1. /**
  2. * set the created date for the user verification
  3. *
  4. * @param string|\DateTime $created_dt the user verification's created date
  5. */
  6. public function setCreated_Dt($created_dt)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Drak
  7. {
  8. if ($created_dt instanceof \DateTime) {
  9. $this->created_dt = $created_dt;
  10. } else {
  11. $this->created_dt = new \DateTime($created_dt);