nabbar/SwaggerValidator-PHP

View on GitHub

Showing 188 of 604 total issues

Method validate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function validate(\SwaggerValidator\Common\Context $context)
    {
        if (!isset($this->type)) {
            return $context->setValidationError(\SwaggerValidator\Common\Context::VALIDATION_TYPE_SWAGGER_ERROR, null, __METHOD__, __LINE__);
        }
Severity: Minor
Found in src/DataType/TypeNumber.php - About 1 hr to fix

    Method jsonUnSerialize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function jsonUnSerialize(\SwaggerValidator\Common\Context $context, $jsonData)
        {
            parent::checkJsonObject($context, $jsonData);
    
            if (count(get_object_vars($jsonData)) > 1) {
    Severity: Minor
    Found in src/DataType/TypeCombined.php - About 1 hr to fix

      Method loadBodyByContent has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function loadBodyByContent($headers, $rawBody)
          {
              $contentType   = null;
              $contentLength = null;
      
      
      Severity: Minor
      Found in src/Common/Context.php - About 1 hr to fix

        Method validate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function validate(\SwaggerValidator\Common\Context $context, $valueParams = null)
            {
                $keyAnyOf = \SwaggerValidator\Common\FactorySwagger::KEY_ANYOF;
                $keyAllOf = \SwaggerValidator\Common\FactorySwagger::KEY_ALLOF;
                $keyOneOf = \SwaggerValidator\Common\FactorySwagger::KEY_ONEOF;
        Severity: Minor
        Found in src/DataType/TypeCombined.php - About 1 hr to fix

          Method autoload has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              final public static function autoload($className)
              {
                  if (\Phar::running() && defined('PHAR_SWAGGER_VALIDATOR_ROOT_PATH')) {
                      $baseDir = PHAR_SWAGGER_VALIDATOR_ROOT_PATH;
                  }
          Severity: Minor
          Found in src/SwaggerAutoload.php - About 1 hr to fix

            Method validate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function validate(\SwaggerValidator\Common\Context $context)
                {
                    if (!$this->__isset('type')) {
                        return $context->setValidationError(\SwaggerValidator\Common\Context::VALIDATION_TYPE_SWAGGER_ERROR, null, __METHOD__, __LINE__);
                    }
            Severity: Minor
            Found in src/DataType/TypeString.php - About 1 hr to fix

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

                  function random_int($min, $max)
                  {
                      if (!is_int($min) || !is_int($max)) {
                          trigger_error('$min and $max must be integer values', E_USER_NOTICE);
                          $min = (int) $min;
              Severity: Minor
              Found in src/Compat.php - About 1 hr to fix

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

                    protected function formatModel(\SwaggerValidator\Common\Context $context, $value)
                    {
                        $keyIn   = \SwaggerValidator\Common\FactorySwagger::KEY_IN;
                        $keyType = \SwaggerValidator\Common\FactorySwagger::KEY_IN;
                
                
                Severity: Minor
                Found in src/DataType/TypeCommon.php - About 1 hr to fix

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

                      public function loadRequestPath($paramName)
                      {
                          // parse from the end to the top
                          $path = array_reverse(explode('/', $this->contextRequestPath));
                  
                  
                  Severity: Minor
                  Found in src/Common/Context.php - About 1 hr to fix

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

                        public function setLocation($value = null)
                        {
                            switch (strtolower($value)) {
                                case \SwaggerValidator\Common\FactorySwagger::LOCATION_BODY:
                                case 'body':
                    Severity: Minor
                    Found in src/Common/ContextBase.php - About 1 hr to fix

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

                          protected function SecurityDefinition(\SwaggerValidator\Common\Context $context, &$jsonData)
                          {
                              $typeKey = self::KEY_TYPE;
                              $flowKey = self::KEY_FLOW;
                      
                      Severity: Minor
                      Found in src/Common/FactorySwagger.php - About 1 hr to fix

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

                            protected function validateOneOf(\SwaggerValidator\Common\Context $context, $valueParams = null)
                            {
                                $keyOneOf = \SwaggerValidator\Common\FactorySwagger::KEY_ONEOF;
                                $check    = false;
                                $result   = false;
                        Severity: Minor
                        Found in src/DataType/TypeCombined.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 format has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function format(\SwaggerValidator\Common\Context $context, $valueParams)
                            {
                                if (!isset($this->format)) {
                                    return true;
                                }
                        Severity: Minor
                        Found in src/DataType/TypeNumber.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 random_int has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            function random_int($min, $max)
                            {
                                if (!is_int($min) || !is_int($max)) {
                                    trigger_error('$min and $max must be integer values', E_USER_NOTICE);
                                    $min = (int) $min;
                        Severity: Minor
                        Found in src/Compat.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 autoload has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            final public static function autoload($className)
                            {
                                if (\Phar::running() && defined('PHAR_SWAGGER_VALIDATOR_ROOT_PATH')) {
                                    $baseDir = PHAR_SWAGGER_VALIDATOR_ROOT_PATH;
                                }
                        Severity: Minor
                        Found in src/SwaggerAutoload.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 getModel has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getModel(\SwaggerValidator\Common\Context $context, $listParameters)
                            {
                                foreach ($this->keys() as $key) {
                        
                                    if (!preg_match('/^([0-9]{3})$|^(default)$/', $key) || !is_object($this->$key) || !($this->$key instanceof \SwaggerValidator\Object\ResponseItem)) {
                        Severity: Minor
                        Found in src/Object/Responses.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 set has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function set(\SwaggerValidator\Common\Context $context, $ref, $value = null)
                            {
                                $id = self::getIdFromRef($context, $ref);
                        
                                if ($id == $ref) {
                        Severity: Minor
                        Found in src/Common/CollectionReference.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 validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function validate(\SwaggerValidator\Common\Context $context)
                            {
                                foreach ($this->keys() as $key) {
                                    if (is_object($this->$key) && ($this->$key instanceof \SwaggerValidator\Object\Operation)) {
                                        continue;
                        Severity: Minor
                        Found in src/Object/PathItem.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 checkProduce has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function checkProduce(\SwaggerValidator\Common\Context $context)
                            {
                                if (!isset($this->produces)) {
                                    return true;
                                }
                        Severity: Minor
                        Found in src/Object/Swagger.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 getModel has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getModel(\SwaggerValidator\Common\Context $context, $generalItems = array())
                            {
                                $result       = array();
                                $generalItems = $this->getMethodGeneric($context, __FUNCTION__, $generalItems);
                        
                        
                        Severity: Minor
                        Found in src/Object/Paths.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

                        Severity
                        Category
                        Status
                        Source
                        Language