NeroReflex/Gishiki

View on GitHub

Showing 48 of 176 total issues

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

    protected static function matchCheck($uriSplit, $urlSplit, array &$params) : bool
    {
        $result = false;

        if ((strlen($uriSplit) >= 7) && ($uriSplit[0] == '{') && ($uriSplit[strlen($uriSplit) - 1] == '}')) {
Severity: Minor
Found in src/Core/Router/MatchableRouteTrait.php - About 1 hr to fix

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

        public function serialize($format = self::JSON)
        {
            if (!is_integer($format)) {
                throw new \InvalidArgumentException('Invalid serialization format');
            }
    Severity: Minor
    Found in src/Algorithms/Collections/SerializableCollection.php - About 1 hr to fix

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

          private static function loadRelation(Column &$column, $className, $propName)
          {
              if (!class_exists($className)) {
                  throw new ActiveRecordException("The class $className doesn't exists.", 109);
              }
      Severity: Minor
      Found in src/Core/MVC/Model/ActiveRecordStructureTrait.php - About 1 hr to fix

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

            public static function matchURI($uri, $url, array &$matchedExpr, array &$matchedGet) : bool
            {
                if (!is_string($url)) {
                    throw new \InvalidArgumentException("The URL must be given as a valid string");
                }
        Severity: Minor
        Found in src/Core/Router/MatchableRouteTrait.php - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                      if ((strcmp($method, RouteInterface::GET) == 0) ||
                          (strcmp($method, RouteInterface::POST) == 0) ||
                          (strcmp($method, RouteInterface::PUT) == 0) ||
                          (strcmp($method, RouteInterface::DELETE) == 0) ||
                          (strcmp($method, RouteInterface::HEAD) == 0) ||
          Severity: Major
          Found in src/Core/Router/Router.php - About 1 hr to fix

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

                public static function isFloat($str) : bool
                {
                    if (!self::isString($str)) {
                        return false;
                    }
            Severity: Minor
            Found in src/Algorithms/Strings/SimpleLexer.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 where has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public function &where(SelectionCriteria $where) : SQLWrapperInterface
                {
                    //execute the private function 'export'
                    $exportMethod = new \ReflectionMethod($where, 'export');
                    $exportMethod->setAccessible(true);
            Severity: Minor
            Found in src/Database/Adapters/Utils/SQLGenerator/SQLWrapper.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 limitOffsetOrderBy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function &limitOffsetOrderBy(ResultModifier $mod) : SQLWrapperInterface
                {
                    //execute the private function 'export'
                    $exportMethod = new \ReflectionMethod($mod, 'export');
                    $exportMethod->setAccessible(true);
            Severity: Minor
            Found in src/Database/Adapters/Utils/SQLGenerator/SQLWrapper.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 matchURI has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function matchURI($uri, $url, array &$matchedExpr, array &$matchedGet) : bool
                {
                    if (!is_string($url)) {
                        throw new \InvalidArgumentException("The URL must be given as a valid string");
                    }
            Severity: Minor
            Found in src/Core/Router/MatchableRouteTrait.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 paramCheck has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                protected static function paramCheck($urlSplit, $type) : bool
                {
                    if ((!is_int($type)) || ($type < 0) || ($type > 4)) {
                        throw new RouterException("Invalid parameter type", 100);
                    }
            Severity: Minor
            Found in src/Core/Router/MatchableRouteTrait.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 loadErrorHandlers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function loadErrorHandlers($method) : array
                {
                    $errorHandlers = [];
            
                    foreach ($this->routes[$method] as &$currentRoute) {
            Severity: Minor
            Found in src/Core/Router/Router.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 __invoke has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function __invoke(RequestInterface &$request, ResponseInterface &$response, GenericCollection &$arguments, $controllerArgs = [], Application $app = null)
            Severity: Minor
            Found in src/Core/Router/Route.php - About 35 mins to fix

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

                  public function __construct(RequestInterface &$controllerRequest, ResponseInterface &$controllerResponse, GenericCollection &$controllerArguments, array &$plugins, Application $app = null)
              Severity: Minor
              Found in src/Core/MVC/Controller/Controller.php - About 35 mins to fix

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

                    public function __invoke(RequestInterface &$request, ResponseInterface &$response, GenericCollection &$arguments, $controllerArgs = [], Application $app = null);
                Severity: Minor
                Found in src/Core/Router/RouteInterface.php - About 35 mins to fix

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

                      public static function pbkdf2($password, $salt, $keyLength, $count, $algorithm = self::SHA256)
                  Severity: Minor
                  Found in src/Security/Hashing/Algorithm.php - About 35 mins to fix

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

                        private function initTransitionSchema()
                        {
                            //table must have been already correctly parsed, so I know data is well-formed
                            if (!ActiveRecordTables::isRegistered(static::class)) {
                                throw new ActiveRecordException("Table definition for the current ActiveRecord object is missing.", 300);
                    Severity: Minor
                    Found in src/Core/MVC/Model/ActiveRecordSerializationTrait.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 loadField has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function loadField(Table &$table, array $fieldDefinition, $fieldName = null)
                        {
                            $field = new GenericCollection($fieldDefinition);
                    
                            if ((!$field->has('name')) || (!is_string($field->get('name'))) || (strlen($field->get('name')) <= 0)) {
                    Severity: Minor
                    Found in src/Core/MVC/Model/ActiveRecordStructureTrait.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 loadRelation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function loadRelation(Column &$column, $className, $propName)
                        {
                            if (!class_exists($className)) {
                                throw new ActiveRecordException("The class $className doesn't exists.", 109);
                            }
                    Severity: Minor
                    Found in src/Core/MVC/Model/ActiveRecordStructureTrait.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 connect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function connect($name, array $details) : Logger
                        {
                            //check for the logger name
                            if ((!is_string($name)) || (strlen($name) <= 0)) {
                                throw new \InvalidArgumentException('The logger name must be given as a valid non-empty string');
                    Severity: Minor
                    Found in src/Logging/LoggerManager.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 $str[$len - 1] != '.';
                    Severity: Major
                    Found in src/Algorithms/Strings/SimpleLexer.php - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language