Leuchtfeuer/mautic-deutschepost

View on GitHub

Showing 31 of 33 total issues

Method deleteAction has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function deleteAction($objectId, $batch = false)
    {
        $this->setSession();
        $page           = $this->session->get(self::SESSION_VARS['page'], 1);
        $viewParameters = ['page' => $page];
Severity: Minor
Found in Controller/TriggerCampaignController.php - About 1 hr to fix

    Method loadValidatorMetadata has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function loadValidatorMetadata(SymfonyClassMetadata $metadata)
        {
            $metadata->addPropertyConstraints('name', [
                new NotBlank([
                    'message' => 'mautic.core.name.required',
    Severity: Minor
    Found in Entity/TriggerCampaign.php - About 1 hr to fix

      Function onPluginUpdate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function onPluginUpdate(Plugin $plugin, MauticFactory $factory, $metadata = null, Schema $installedSchema = null)
          {
              $database    = $factory->getDatabase();
              $platform    = $database->getDatabasePlatform()->getName();
              $queries     = [];
      Severity: Minor
      Found in LeuchtfeuerPrintmailingBundle.php - About 55 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function dispatchEvent has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function dispatchEvent($action, &$entity, $isNew = false, Event $event = null)
          {
              if (!$entity instanceof TriggerCampaign) {
                  throw new MethodNotAllowedHttpException(['TriggerCampaign']);
              }
      Severity: Minor
      Found in Model/TriggerCampaignModel.php - About 55 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method listCampaigns has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function listCampaigns(int $offset = 0, int $pageNumber = 0, int $pageSize = 10, bool $paged = true, bool $unpaged = false, bool $forceFirstAndLastRels = false): array
      Severity: Minor
      Found in Service/PrintmailingService.php - About 45 mins to fix

        Method getTriggerCampaigns has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            protected function getTriggerCampaigns($filter, $start, $limit, $orderBy, $orderByDir)
        Severity: Minor
        Found in Controller/TriggerCampaignController.php - About 35 mins to fix

          Function deleteAction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function deleteAction($objectId, $batch = false)
              {
                  $this->setSession();
                  $page           = $this->session->get(self::SESSION_VARS['page'], 1);
                  $viewParameters = ['page' => $page];
          Severity: Minor
          Found in Controller/TriggerCampaignController.php - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function deleteMultipleCampaigns has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function deleteMultipleCampaigns($postActionVars, &$flashes)
              {
                  /** @var TriggerCampaignModel $triggerCampaignModel */
                  $triggerCampaignModel = $this->getModel(TriggerCampaignModel::NAME);
                  $triggerCampaignIds   = json_decode($this->request->query->get('ids', '{}'));
          Severity: Minor
          Found in Controller/TriggerCampaignController.php - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function onTriggerCampaignPreSave has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function onTriggerCampaignPreSave(TriggerCampaignEvent $event): void
              {
                  $triggerCampaign = $event->getTriggerCampaign();
          
                  if ($triggerCampaign->isNew()) {
          Severity: Minor
          Found in EventListener/CampaignSubscriber.php - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Avoid too many return statements within this method.
          Open

                  return $this->delegateView([
                      'viewParameters' => [
                          'form'          => $this->setFormTheme($form, self::TEMPLATES['form'], self::THEMES['variables']),
                          'currentListId' => $triggerCampaign->getId(),
                      ],
          Severity: Major
          Found in Controller/TriggerCampaignController.php - About 30 mins to fix

            Function printmailingOnLoad has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            Mautic.printmailingOnLoad = function (container) {
                var prefix = 'trigger_campaign';
                var parent = mQuery('.dynamic-content-variable, .dwc-variable');
                if (parent.length) {
                    prefix = parent.attr('id');
            Severity: Minor
            Found in Assets/js/printmailing.js - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Severity
            Category
            Status
            Source
            Language