nabbar/SwaggerValidator-PHP

View on GitHub

Showing 188 of 604 total issues

Function buildObjectFromOriginObject has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    protected function buildObjectFromOriginObject(\SwaggerValidator\Common\Context $context, $originType, $originKey, &$jsonData)
    {
        $keyIn   = self::KEY_IN;
        $keyName = self::KEY_NAME;
        $object  = null;
Severity: Minor
Found in src/Common/FactorySwagger.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 jsonSerialize has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function jsonSerialize()
    {
        if (parent::__isset(\SwaggerValidator\Common\FactorySwagger::KEY_SCHEMA)) {
            return parent::jsonSerialize();
        }
Severity: Minor
Found in src/DataType/TypeObject.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 format has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    protected function format(\SwaggerValidator\Common\Context $context, $valueParams)
    {
        if (!$this->__isset('format') || empty($this->format)) {
            return true;
        }
Severity: Minor
Found in src/DataType/TypeString.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 getMethodGeneric has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getMethodGeneric(\SwaggerValidator\Common\Context $context, $method, $generalItems = array(), $typeKey = null, $params = array())
    {
        if (!is_array($generalItems) && empty($typeKey)) {
            $generalItems = array(
                \SwaggerValidator\Common\FactorySwagger::KEY_PARAMETERS => array(),
Severity: Minor
Found in src/Common/CollectionSwagger.php - About 1 hr to fix

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

        protected function format(\SwaggerValidator\Common\Context $context, $valueParams)
        {
            if (!$this->__isset('format') || empty($this->format)) {
                return true;
            }
    Severity: Minor
    Found in src/DataType/TypeString.php - About 1 hr to fix

      Method __construct has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __construct(\SwaggerValidator\Common\Context $context, $filepath)
          {
              $this->fileUri = $filepath;
      
              $urlPart = parse_url($filepath);
      Severity: Minor
      Found in src/Common/ReferenceFile.php - About 1 hr to fix

        Method dataLoad has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function dataLoad()
            {
                $paramName = $this->__get('DataPath');
                $paramName = array_pop($paramName);
        
        
        Severity: Minor
        Found in src/Common/Context.php - About 1 hr to fix

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

              public function dataLoad()
              {
                  $paramName = $this->__get('DataPath');
                  $paramName = array_pop($paramName);
          
          
          Severity: Minor
          Found in src/Common/Context.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 getMethodGeneric has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function getMethodGeneric(\SwaggerValidator\Common\Context $context, $method, $generalItems = array(), $typeKey = null, $params = array())
              {
                  if (!is_array($generalItems) && empty($typeKey)) {
                      $generalItems = array(
                          \SwaggerValidator\Common\FactorySwagger::KEY_PARAMETERS => array(),
          Severity: Minor
          Found in src/Common/CollectionSwagger.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 format has 35 lines of code (exceeds 25 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 1 hr to fix

            Method validate has 35 lines of code (exceeds 25 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 1 hr to fix

              Method validate has 34 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/TypeInteger.php - About 1 hr to fix

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

                    public function jsonSerialize()
                    {
                        if (parent::__isset(\SwaggerValidator\Common\FactorySwagger::KEY_SCHEMA)) {
                            return parent::jsonSerialize();
                        }
                Severity: Minor
                Found in src/DataType/TypeObject.php - About 1 hr to fix

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

                      public function jsonUnSerialize(\SwaggerValidator\Common\Context $context, $jsonData)
                      {
                          $this->checkJsonObjectOrArray($context, $jsonData);
                  
                          $keyType       = \SwaggerValidator\Common\FactorySwagger::KEY_TYPE;
                  Severity: Minor
                  Found in src/DataType/TypeArrayItems.php - About 1 hr to fix

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

                        public function jsonUnSerialize(\SwaggerValidator\Common\Context $context, $originType, $originKey, &$jsonData)
                        {
                            $keyType   = self::KEY_TYPE;
                            $keyCustom = self::KEY_CUSTOM_PATTERN;
                            $notCustom = array(
                    Severity: Minor
                    Found in src/Common/FactorySwagger.php - About 1 hr to fix

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

                          protected function getExampleFormat(\SwaggerValidator\Common\Context $context)
                          {
                              if ($this->format == 'byte') {
                                  /**
                                   * @see RFC 4648 : http://www.ietf.org/rfc/rfc4648.txt
                      Severity: Minor
                      Found in src/DataType/TypeString.php - About 1 hr to fix

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

                            protected function buildObjectFromOriginKey(\SwaggerValidator\Common\Context $context, $originType, $originKey, &$jsonData)
                            {
                                $object = null;
                        
                                if (!empty(self::$keyToObject[$originKey])) {
                        Severity: Minor
                        Found in src/Common/FactorySwagger.php - About 1 hr to fix

                          Function getReference has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function getReference(\SwaggerValidator\Common\Context $context, $ref)
                              {
                                  $obj            = $this->fileObj;
                                  $propertiesList = explode('/', $ref);
                                  array_shift($propertiesList);
                          Severity: Minor
                          Found in src/Common/ReferenceFile.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 parseQueryAsMulti has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function parseQueryAsMulti($queryString)
                              {
                                  $params = explode('&', $queryString);
                                  $result = array();
                          
                          
                          Severity: Minor
                          Found in src/Common/Context.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 validate has a Cognitive Complexity of 11 (exceeds 5 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

                          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