lovata/oc-toolbox-plugin

View on GitHub

Showing 71 of 236 total issues

File ElementCollection.php has 418 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php namespace Lovata\Toolbox\Classes\Collection;

use ArrayIterator;
use October\Contracts\Twig\CallsAnyMethod;
use October\Rain\Extension\Extendable;
Severity: Minor
Found in classes/collection/ElementCollection.php - About 6 hrs to fix

    ElementCollection has 40 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class ElementCollection extends Extendable implements CallsAnyMethod, \IteratorAggregate, \Countable
    {
        const COUNT_PER_PAGE = 10;
        const ITEM_CLASS = \Lovata\Toolbox\Classes\Item\ElementItem::class;
    
    
    Severity: Minor
    Found in classes/collection/ElementCollection.php - About 5 hrs to fix

      File CommonCreateFile.php has 371 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php namespace Lovata\Toolbox\Classes\Console;
      
      use Lang;
      use Illuminate\Console\Command;
      use Symfony\Component\Console\Input\InputArgument;
      Severity: Minor
      Found in classes/console/CommonCreateFile.php - About 4 hrs to fix

        ElementItem has 31 functions (exceeds 20 allowed). Consider refactoring.
        Open

        abstract class ElementItem extends MainItem
        {
            use ExtendableTrait;
        
            const MODEL_CLASS = Model::class;
        Severity: Minor
        Found in classes/item/ElementItem.php - About 3 hrs to fix

          File CommonProperty.php has 316 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php namespace Lovata\Toolbox\Models;
          
          use Lang;
          use Backend\Models\ImportModel;
          use October\Rain\Database\Traits\Validation;
          Severity: Minor
          Found in models/CommonProperty.php - About 3 hrs to fix

            File ElementItem.php has 307 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php namespace Lovata\Toolbox\Classes\Item;
            
            use Model;
            use October\Rain\Extension\ExtendableTrait;
            
            
            Severity: Minor
            Found in classes/item/ElementItem.php - About 3 hrs to fix

              Function importImageList has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function importImageList()
                  {
                      if (!$this->bNeedUpdateImageList) {
                          return;
                      }
              Severity: Minor
              Found in classes/helper/AbstractImportModel.php - About 3 hrs 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 handle has 77 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function handle()
                  {
                      $this->logoToolBox();
              
                      $arHeaderList = [self::HEADER_COMMAND_LIST, self::HEADER_DESCRIPTION];
              Severity: Major
              Found in classes/console/ToolBoxHelper.php - About 3 hrs to fix

                Function getUrlParamList has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getUrlParamList($sPageCode, $sComponentName, $sParamName = 'slug', $bFindWildcard = false)
                    {
                        $sCacheKey = implode('_', [$sPageCode, $sComponentName, $sParamName, (int) $bFindWildcard]);
                        if ($this->hasCache($sCacheKey)) {
                            return $this->getCachedData($sCacheKey);
                Severity: Minor
                Found in classes/helper/PageHelper.php - About 2 hrs 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 parse has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function parse()
                    {
                        if (empty($this->arImportSettings)) {
                            return;
                        }
                Severity: Minor
                Found in classes/helper/ParseXMLNode.php - About 2 hrs 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

                CommonCreateFile has 22 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class CommonCreateFile extends Command
                {
                    use LogoTrait;
                
                    const PREFIX_LOWER   = 'lower_';
                Severity: Minor
                Found in classes/console/CommonCreateFile.php - About 2 hrs to fix

                  CommonProperty has 22 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class CommonProperty extends ImportModel
                  {
                      const NAME = 'property';
                  
                      use Validation;
                  Severity: Minor
                  Found in models/CommonProperty.php - About 2 hrs to fix

                    Function setLangProperties has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function setLangProperties()
                        {
                            if (empty($this->obElement) || !$this->obElement->isClassExtendedWith('RainLab.Translate.Behaviors.TranslatableModel')) {
                                return;
                            }
                    Severity: Minor
                    Found in classes/item/ElementItem.php - About 2 hrs 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 getWidgetData has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getWidgetData()
                        {
                            $arResult = [];
                    
                            switch ($this->type) {
                    Severity: Minor
                    Found in models/CommonProperty.php - About 2 hrs 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 getWidgetData has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getWidgetData()
                        {
                            $arResult = [];
                    
                            switch ($this->type) {
                    Severity: Major
                    Found in models/CommonProperty.php - About 2 hrs to fix

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

                          protected function callCommandList()
                          {
                              $sMessage = Lang::get('lovata.toolbox::lang.message.create', ['name' => self::CODE_MODEL]);
                      
                              if ($this->confirm($sMessage, true)) {
                      Severity: Minor
                      Found in classes/console/CreateAll.php - About 1 hr to fix

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

                            protected function sendMail($sEmail)
                            {
                                if (empty($this->sMailTemplate) || empty($sEmail)) {
                                    return;
                                }
                        Severity: Minor
                        Found in classes/helper/SendMailHelper.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 getElementListFromDB has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function getElementListFromDB($arElementIDList, $arResult)
                            {
                                if (empty($arElementIDList)) {
                                    return $arResult;
                                }
                        Severity: Minor
                        Found in classes/collection/ElementCollection.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

                        Method parse has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function parse()
                            {
                                if (empty($this->arImportSettings)) {
                                    return;
                                }
                        Severity: Minor
                        Found in classes/helper/ParseXMLNode.php - About 1 hr to fix

                          Method getUrlParamList has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function getUrlParamList($sPageCode, $sComponentName, $sParamName = 'slug', $bFindWildcard = false)
                              {
                                  $sCacheKey = implode('_', [$sPageCode, $sComponentName, $sParamName, (int) $bFindWildcard]);
                                  if ($this->hasCache($sCacheKey)) {
                                      return $this->getCachedData($sCacheKey);
                          Severity: Minor
                          Found in classes/helper/PageHelper.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language