Leuchtfeuer/mautic-deutschepost

View on GitHub

Showing 31 of 33 total issues

File TriggerCampaignController.php has 463 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace MauticPlugin\LeuchtfeuerPrintmailingBundle\Controller;

use Doctrine\ORM\EntityNotFoundException;
Severity: Minor
Found in Controller/TriggerCampaignController.php - About 7 hrs to fix

    File PrintmailingService.php has 427 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace MauticPlugin\LeuchtfeuerPrintmailingBundle\Service;
    
    use GuzzleHttp\Client;
    Severity: Minor
    Found in Service/PrintmailingService.php - About 6 hrs to fix

      Method buildForm has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function buildForm(FormBuilderInterface $builder, array $options)
          {
              $builder->addEventSubscriber(new CleanFormSubscriber(['description' => 'html']));
              $builder->addEventSubscriber(new FormExitSubscriber(TriggerCampaignModel::NAME, $options));
      
      
      Severity: Major
      Found in Form/Type/TriggerCampaignType.php - About 3 hrs to fix

        TriggerCampaignController has 25 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class TriggerCampaignController extends AbstractFormController
        {
            public const PERMISSIONS = [
                'create'  => 'printmailing:campaigns:create',
                'delete'  => 'printmailing:campaigns:delete',
        Severity: Minor
        Found in Controller/TriggerCampaignController.php - About 2 hrs to fix

          Method createTriggerCampaignModifyRequest has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function createTriggerCampaignModifyRequest(TriggerCampaign $triggerCampaign, array $postActionVars, $action, $ignorePost)
              {
                  /** @var TriggerCampaignModel $triggerCampaignModel */
                  $triggerCampaignModel = $this->getModel(TriggerCampaignModel::NAME);
          
          
          Severity: Major
          Found in Controller/TriggerCampaignController.php - About 2 hrs to fix

            TriggerCampaign has 23 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class TriggerCampaign extends FormEntity
            {
                public const ALLOWED_TYPES = [
                    'string'      => 'plugin.printmailing.form.types.string',
                    'integer'     => 'plugin.printmailing.form.types.integer',
            Severity: Minor
            Found in Entity/TriggerCampaign.php - About 2 hrs to fix

              PrintmailingService has 23 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class PrintmailingService
              {
                  public const LOCALE = 'de';
              
                  public const SESSION_KEY = 'printmailing';
              Severity: Minor
              Found in Service/PrintmailingService.php - About 2 hrs to fix

                Method buildForm has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function buildForm(FormBuilderInterface $builder, array $options): void
                    {
                        $builder->add('printmailing_masId', IntegerType::class, [
                            'label'      => 'plugin.printmailing.form.masId',
                            'label_attr' => [
                Severity: Major
                Found in Form/Type/ConfigType.php - About 2 hrs to fix

                  Method newAction has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function newAction()
                      {
                          $this->setSession();
                  
                          if (!$this->get('mautic.security')->isGranted(self::PERMISSIONS['create'])) {
                  Severity: Major
                  Found in Controller/TriggerCampaignController.php - About 2 hrs to fix

                    Function printmailingOnLoad has 56 lines of code (exceeds 25 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: Major
                    Found in Assets/js/printmailing.js - About 2 hrs to fix

                      Function newAction has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function newAction()
                          {
                              $this->setSession();
                      
                              if (!$this->get('mautic.security')->isGranted(self::PERMISSIONS['create'])) {
                      Severity: Minor
                      Found in Controller/TriggerCampaignController.php - About 1 hr 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 addPrintmailingVariable has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      Mautic.addPrintmailingVariable = function (elId, elObj) {
                          var variableId = '#available_' + elObj + '_' + elId,
                              variableOption = mQuery(variableId),
                              label = variableOption.text(),
                              variableNum = parseInt(mQuery('.available-variables').data('index')),
                      Severity: Minor
                      Found in Assets/js/printmailing.js - About 1 hr to fix

                        Method indexAction has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function indexAction($page = 1)
                            {
                                //set some permissions
                                $permissions = $this->getPermissions();
                                if (!$permissions[self::PERMISSIONS['view']]) {
                        Severity: Minor
                        Found in Controller/TriggerCampaignController.php - About 1 hr to fix

                          Function createTriggerCampaignModifyRequest has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function createTriggerCampaignModifyRequest(TriggerCampaign $triggerCampaign, array $postActionVars, $action, $ignorePost)
                              {
                                  /** @var TriggerCampaignModel $triggerCampaignModel */
                                  $triggerCampaignModel = $this->getModel(TriggerCampaignModel::NAME);
                          
                          
                          Severity: Minor
                          Found in Controller/TriggerCampaignController.php - About 1 hr 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 reorderTriggerCampaignVariables has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          Mautic.reorderTriggerCampaignVariables = function () {
                              // Update the filter numbers sot that they are ordered correctly when processed and grouped server side
                              var counter = 0,
                                  prefix = 'trigger_campaign',
                                  parent = mQuery('.dynamic-content-variable, .dwc-variable');
                          Severity: Minor
                          Found in Assets/js/printmailing.js - About 1 hr to fix

                            Method deleteMultipleCampaigns has 29 lines of code (exceeds 25 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 1 hr to fix

                              Method onPluginUpdate has 29 lines of code (exceeds 25 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 1 hr to fix

                                Method editAction has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function editAction($objectId, $ignorePost = false, $clone = false)
                                    {
                                        $this->setSession();
                                        $postActionVars = $this->getPostActionVars();
                                
                                
                                Severity: Minor
                                Found in Controller/TriggerCampaignController.php - About 1 hr to fix

                                  Method onCampaignTriggerAction has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function onCampaignTriggerAction(CampaignExecutionEvent $event)
                                      {
                                          if (false === $event->checkContext('plugin.printmailing.campaign')) {
                                              return;
                                          }
                                  Severity: Minor
                                  Found in EventListener/CampaignSubscriber.php - About 1 hr to fix

                                    Method dispatchEvent has 28 lines of code (exceeds 25 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 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language