PHPColibri/framework

View on GitHub

Showing 31 of 31 total issues

ModelCollection has 38 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class ModelCollection extends DynamicCollection implements DynamicCollectionInterface
{
    /** @var string|\Colibri\Database\Model */
    protected static $itemClass = 'itemClass_not_set';
    /** @var array */
Severity: Minor
Found in Database/ModelCollection.php - About 5 hrs to fix

    Model has 36 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class Model
    {
        const NEW_OBJECT = -1;
    
        /** @var string */
    Severity: Minor
    Found in Database/Model.php - About 4 hrs to fix

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

      abstract class Command extends SymfonyCommand
      {
          const COMMAND_NS = 'Application\Command\\';
      
          /** @var InputInterface */
      Severity: Minor
      Found in Console/Command.php - About 3 hrs to fix

        Query has 29 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Query
        {
            /** @var \Colibri\Database\AbstractDb\DriverInterface */
            private $db;
            /** @var string */
        Severity: Minor
        Found in Database/Query.php - About 3 hrs to fix

          File Model.php has 285 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          namespace Colibri\Database;
          
          use Carbon\Carbon;
          use Colibri\Database\Exception\NotFoundException;
          Severity: Minor
          Found in Database/Model.php - About 2 hrs to fix

            File ModelCollection.php has 277 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            namespace Colibri\Database;
            
            use Colibri\Base\DynamicCollection;
            use Colibri\Base\DynamicCollectionInterface;
            Severity: Minor
            Found in Database/ModelCollection.php - About 2 hrs to fix

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

              class Layout extends Helper
              {
                  /**
                   * @var string name of layout template to use
                   */
              Severity: Minor
              Found in View/Layout.php - About 2 hrs to fix

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

                class Validation
                {
                    /** @var string */
                    public static $requiredMessage = 'поле \'%s\' является обязательным для заполнения.';
                    /** @var string */
                Severity: Minor
                Found in Validation/Validation.php - About 2 hrs to fix

                  Method calcResizeParams has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private static function calcResizeParams($resizeType, $img, $tmbWidth, $tmbHeight)
                      {
                          list($width, $height) = self::getImageSize($img);
                  
                          switch ($resizeType) {
                  Severity: Major
                  Found in Util/Image.php - About 2 hrs to fix

                    Method prepareValue has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function prepareValue(&$value, $type)
                        {
                            if ($value === null) {
                                return $value = 'NULL';
                            }
                    Severity: Minor
                    Found in Database/AbstractDb/Driver/Query/Builder.php - About 1 hr to fix

                      Method build has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function build(Query $query): string
                          {
                              $this->query = $query;
                      
                              $sql = $this->buildQueryStart();
                      Severity: Minor
                      Found in Database/AbstractDb/Driver/Query/Builder.php - About 1 hr to fix

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

                            public function isEqual(array $keys, $message = null)
                            {
                                $existingKey = null;
                                foreach ($keys as $key) {
                                    if (isset($this->scope[$key])) {
                        Severity: Minor
                        Found in Validation/Validation.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 calcResizeParams has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private static function calcResizeParams($resizeType, $img, $tmbWidth, $tmbHeight)
                            {
                                list($width, $height) = self::getImageSize($img);
                        
                                switch ($resizeType) {
                        Severity: Minor
                        Found in Util/Image.php - About 45 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 prepareValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function prepareValue(&$value, $type)
                            {
                                if ($value === null) {
                                    return $value = 'NULL';
                                }
                        Severity: Minor
                        Found in Database/AbstractDb/Driver/Query/Builder.php - About 45 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 generateGUID has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function generateGUID(): string
                            {
                                $guidStr = '';
                                for ($i = 1; $i <= 16; $i++) {
                                    $b = (int)mt_rand(0, 0xff);
                        Severity: Minor
                        Found in Util/Str.php - About 45 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 send has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public static function send(string $to, string $subject, string $view, array $viewVars = [], $builder = null, $from = 'default')
                        Severity: Minor
                        Found in Mail/Mail.php - About 45 mins to fix

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

                              public static function call(string $division, string $module, string $class, string $method, array $params)
                          Severity: Minor
                          Found in Controller/Dispatcher.php - About 35 mins to fix

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

                                public function __construct($host, $login, $pass, $database, $persistent = false)
                            Severity: Minor
                            Found in Database/Concrete/MySQL/Connection.php - About 35 mins to fix

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

                                  public static function createThumbnail($path, $width = 100, $height = 100, $resizeType = self::RESIZE_FILLED, $bgColor = 0xfff5ee)
                              Severity: Minor
                              Found in Util/Image.php - About 35 mins to fix

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

                                    public function required($key, $message = null)
                                    {
                                        if (is_array($key)) {
                                            foreach ($key as $name) {
                                                $this->required($name, $message);
                                Severity: Minor
                                Found in Validation/Validation.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

                                Severity
                                Category
                                Status
                                Source
                                Language