nabbar/SwaggerValidator-PHP

View on GitHub

Showing 188 of 604 total issues

File Context.php has 642 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
 * Copyright 2016 Nicolas JUHEL <swaggervalidator@nabbar.com>.
 *
Severity: Major
Found in src/Common/Context.php - About 1 day to fix

    ContextBase has 51 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ContextBase implements \SwaggerValidator\Interfaces\ContextBase
    {
    
        /**
         *
    Severity: Major
    Found in src/Common/ContextBase.php - About 7 hrs to fix

      Context has 42 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Context extends ContextBase implements \SwaggerValidator\Interfaces\ContextLog, \SwaggerValidator\Interfaces\ContextDataLoader, \SwaggerValidator\Interfaces\ContextDataParser
      {
          /*
           * Mode Constants
           */
      Severity: Minor
      Found in src/Common/Context.php - About 5 hrs to fix

        Function validate has a Cognitive Complexity of 37 (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\PathItem)) {
                        continue;
        Severity: Minor
        Found in src/Object/Paths.php - About 5 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

        File ContextBase.php has 389 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /*
         * Copyright 2016 Nicolas JUHEL<swaggervalidator@nabbar.com>.
         *
        Severity: Minor
        Found in src/Common/ContextBase.php - About 5 hrs to fix

          Sandbox has 32 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Sandbox
          {
          
              /**
               *
          Severity: Minor
          Found in src/Common/Sandbox.php - About 4 hrs to fix

            Function validate has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                public function validate(\SwaggerValidator\Common\Context $context)
                {
                    $keyRequired   = \SwaggerValidator\Common\FactorySwagger::KEY_REQUIRED;
                    $keyAdditional = \SwaggerValidator\Common\FactorySwagger::KEY_ADDPROPERTIES;
            
            Severity: Minor
            Found in src/DataType/TypeObject.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

            File FactorySwagger.php has 327 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            /*
             * Copyright 2016 Nicolas JUHEL <swaggervalidator@nabbar.com>.
             *
            Severity: Minor
            Found in src/Common/FactorySwagger.php - About 3 hrs to fix

              TypeCommon has 28 functions (exceeds 20 allowed). Consider refactoring.
              Open

              abstract class TypeCommon extends \SwaggerValidator\Common\CollectionSwagger
              {
              
                  abstract protected function type(\SwaggerValidator\Common\Context $context, $valueParams);
              
              
              Severity: Minor
              Found in src/DataType/TypeCommon.php - About 3 hrs to fix

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

                    public function getModel(\SwaggerValidator\Common\Context $context)
                    {
                        $result   = new \stdClass();
                        $keyAnyOf = \SwaggerValidator\Common\FactorySwagger::KEY_ANYOF;
                        $keyAllOf = \SwaggerValidator\Common\FactorySwagger::KEY_ALLOF;
                Severity: Minor
                Found in src/DataType/TypeCombined.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

                Function buildBodyXml has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function buildBodyXml($contents)
                    {
                        $this->contextDataType   = self::CONTENT_TYPE_XML;
                        $this->contextDataExists = (bool) (strlen($contents) > 0);
                        $this->contextDataValue  = simplexml_load_string($contents);
                Severity: Minor
                Found in src/Common/Context.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 validate has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function validate(\SwaggerValidator\Common\Context $context, $valueParams = null)
                    {
                        $result    = true;
                        $lastKey   = null;
                        $keySchema = \SwaggerValidator\Common\FactorySwagger::KEY_SCHEMA;
                Severity: Minor
                Found in src/DataType/TypeArrayItems.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 jsonUnSerialize has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function jsonUnSerialize(\SwaggerValidator\Common\Context $context, $jsonData)
                    {
                        $this->checkJsonObject($context, $jsonData);
                
                        if (property_exists($jsonData, \SwaggerValidator\Common\FactorySwagger::KEY_REFERENCE) && count(get_object_vars($jsonData)) > 1) {
                Severity: Minor
                Found in src/DataType/TypeObject.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 setValidationError has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function setValidationError($valitionType, $messageException = null, $method = null, $line = null)
                    {
                        $this->logValidationError($valitionType, $messageException, $method, $line);
                
                        if ($this->__get('IsCombined')) {
                Severity: Major
                Found in src/Common/Context.php - About 2 hrs to fix

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

                  class Collection implements \Countable, \IteratorAggregate, \ArrayAccess, \Serializable, \JsonSerializable
                  {
                  
                      /**
                       *
                  Severity: Minor
                  Found in src/Common/Collection.php - About 2 hrs to fix

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

                    class CollectionReference extends \SwaggerValidator\Common\Collection
                    {
                    
                        const ID_PREFIX = 'id:';
                    
                    
                    Severity: Minor
                    Found in src/Common/CollectionReference.php - About 2 hrs to fix

                      File TypeCommon.php has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      /*
                       * Copyright 2016 Nicolas JUHEL <swaggervalidator@nabbar.com>.
                       *
                      Severity: Minor
                      Found in src/DataType/TypeCommon.php - About 2 hrs to fix

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

                            protected function validateTooMany(\SwaggerValidator\Common\Context $context)
                            {
                                $sandBox = $context->getSandBoxKeys();
                        
                                foreach ($context->getRequestDataKeys() as $location => $list) {
                        Severity: Minor
                        Found in src/Object/Swagger.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 validate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function validate(\SwaggerValidator\Common\Context $context)
                            {
                                $keyType        = \SwaggerValidator\Common\FactorySwagger::KEY_TYPE;
                                $keyItems       = \SwaggerValidator\Common\FactorySwagger::KEY_ITEMS;
                                $keyAdditional  = \SwaggerValidator\Common\FactorySwagger::KEY_ADDITEMS;
                        Severity: Minor
                        Found in src/DataType/TypeArray.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 validate has 53 lines of code (exceeds 25 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\PathItem)) {
                                        continue;
                        Severity: Major
                        Found in src/Object/Paths.php - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language