nabbar/SwaggerValidator-PHP

View on GitHub

Showing 188 of 604 total issues

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

    function getModel(\SwaggerValidator\Common\Context $context, $listParameters)
    {
        foreach ($this->keys() as $key) {
            $model = null;
            $in    = null;
Severity: Minor
Found in src/Object/Parameters.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 checkConsume has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function checkConsume(\SwaggerValidator\Common\Context $context)
    {
        if (!isset($this->consume)) {
            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 apache_request_headers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    function apache_request_headers()
    {
        $arh = array();

        foreach ($_SERVER as $key => $val) {
Severity: Minor
Found in src/Compat.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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate(\SwaggerValidator\Common\Context $context)
    {
        if ($context->getLocation() !== \SwaggerValidator\Common\FactorySwagger::LOCATION_FORM) {
            return $context->setDataCheck('location/type')->setValidationError(\SwaggerValidator\Common\Context::VALIDATION_TYPE_SWAGGER_ERROR, null, __METHOD__, __LINE__);
        }
Severity: Minor
Found in src/DataType/TypeFile.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 getExampleFormat has a Cognitive Complexity of 8 (exceeds 5 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 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 formatModel has a Cognitive Complexity of 8 (exceeds 5 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 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

Consider simplifying this complex logical expression.
Open

        if (!empty($originType) && !empty($originKey) && !in_array($originType, $notCustom) && substr($originKey, 0, strlen($keyCustom)) === $keyCustom) {
            return $jsonData;
        }
        elseif (empty($originType) && !empty($originKey) && substr($originKey, 0, strlen($keyCustom)) === $keyCustom) {
            return $jsonData;
Severity: Major
Found in src/Common/FactorySwagger.php - About 40 mins to fix

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

        public function logReference($type, $ref, $oldRef = null, $method = null, $line = null);
    Severity: Minor
    Found in src/Interfaces/ContextLog.php - About 35 mins to fix

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

          protected function returnBuildObject(\SwaggerValidator\Common\Context $context, \SwaggerValidator\Common\CollectionSwagger $object, $originType, $originKey, &$jsonData)
      Severity: Minor
      Found in src/Common/FactorySwagger.php - About 35 mins to fix

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

            public function logReference($type, $ref, $oldRef = null, $method = null, $line = null)
        Severity: Minor
        Found in src/Common/Context.php - About 35 mins to fix

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

              protected function getMethodGeneric(\SwaggerValidator\Common\Context $context, $method, $generalItems = array(), $typeKey = null, $params = array())
          Severity: Minor
          Found in src/Common/CollectionSwagger.php - About 35 mins to fix

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

                public function registerCallable(\SwaggerValidator\Common\Context $context, $type, $callable)
                {
                    if (!$this->__isset($type)) {
                        $context->throwException('Cannot find type : "' . $type . '" (Normalized : "' . $this->normalizeType($type) . '" ', __FILE__, __LINE__);
                    }
            Severity: Minor
            Found in src/Common/CollectionType.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 extractReferenceArray has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                private function extractReferenceArray(\SwaggerValidator\Common\Context $context, array &$array)
                {
                    $refList = array();
            
                    foreach ($array as $key => $value) {
            Severity: Minor
            Found in src/Common/ReferenceFile.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 getModel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getModel(\SwaggerValidator\Common\Context $context)
                {
                    $result = new \stdClass();
            
                    foreach ($this->properties as $key) {
            Severity: Minor
            Found in src/DataType/TypeObject.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 format has a Cognitive Complexity of 7 (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/TypeInteger.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 getModelConsumeProduce has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function getModelConsumeProduce($generalItems = array())
                {
                    $list = array(
                        \SwaggerValidator\Common\FactorySwagger::KEY_CONSUMES,
                        \SwaggerValidator\Common\FactorySwagger::KEY_PRODUCES,
            Severity: Minor
            Found in src/Common/CollectionSwagger.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 getModel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getModel(\SwaggerValidator\Common\Context $context, $globalResponse = array())
                {
                    $headersKey = \SwaggerValidator\Common\FactorySwagger::KEY_HEADERS;
                    $schemaKey  = \SwaggerValidator\Common\FactorySwagger::KEY_SCHEMA;
            
            Severity: Minor
            Found in src/Object/ResponseItem.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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function validate(\SwaggerValidator\Common\Context $context)
                {
                    if ($context->getType() !== \SwaggerValidator\Common\Context::TYPE_REQUEST) {
                        return true;
                    }
            Severity: Minor
            Found in src/Object/Parameters.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 extractReferenceArray has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                private function extractReferenceArray(\SwaggerValidator\Common\Context $context, array &$array)
                {
                    $refList = array();
            
                    foreach ($array as $key => $value) {
            Severity: Minor
            Found in src/Common/ReferenceItem.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 jsonUnSerialize has a Cognitive Complexity of 7 (exceeds 5 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 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