nabbar/SwaggerValidator-PHP

View on GitHub

Showing 188 of 604 total issues

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

    public function logReference($type, $ref, $oldRef = null, $method = null, $line = null)
    {
        if (self::getConfig('log', 'reference') || self::getConfig('log', $type . 'Ref')) {
            switch ($type) {
                case 'replace':
Severity: Minor
Found in src/Common/Context.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 setSandBox has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function setSandBox()
    {
        if ($this->getType() !== self::TYPE_REQUEST) {
            return $this;
        }
Severity: Minor
Found in src/Common/Context.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 extractReferenceObject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function extractReferenceObject(\SwaggerValidator\Common\Context $context, \stdClass &$stdClass)
    {
        $refList = array();

        foreach (get_object_vars($stdClass) 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 extractReferenceObject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function extractReferenceObject(\SwaggerValidator\Common\Context $context, \stdClass &$stdClass)
    {
        $refList = array();

        foreach (get_object_vars($stdClass) 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 registerRecursiveDefinitionsFromObject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function registerRecursiveDefinitionsFromObject(\SwaggerValidator\Common\Context $context, \stdClass &$jsonData)
    {
        if (!is_object($jsonData) || !($jsonData instanceof \stdClass)) {
            return;
        }
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 jsonUnSerialize has a Cognitive Complexity of 7 (exceeds 5 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 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 registerRecursiveDefinitionsFromArray has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function registerRecursiveDefinitionsFromArray(\SwaggerValidator\Common\Context $context, array &$jsonData)
    {
        if (!is_array($jsonData) || empty($jsonData)) {
            return;
        }
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 loadBodyByContent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadBodyByContent($headers, $rawBody)
    {
        $contentType   = null;
        $contentLength = null;

Severity: Minor
Found in src/Common/Context.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 getFileLink has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function getFileLink(\SwaggerValidator\Common\Context $context, $uri)
    {
        $scheme = parse_url($uri, PHP_URL_SCHEME);

        if (strtolower($scheme) == 'file') {
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 setLocation has a Cognitive Complexity of 7 (exceeds 5 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 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)
    {
        if (!is_object($jsonData)) {
            $context->throwException('Mismatching type of JSON Data received', __METHOD__, __LINE__);
        }
Severity: Minor
Found in src/DataType/TypeArray.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 unserialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function unserialize($data)
    {
        if (!is_array($data)) {
            $data = unserialize($data);
        }
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

Avoid too many return statements within this method.
Open

            return $this->buildPrimitive($context, $originType, $originKey, $jsonData);
Severity: Major
Found in src/Common/FactorySwagger.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return $context->setDataCheck('maximum')->setValidationError(\SwaggerValidator\Common\Context::VALIDATION_TYPE_DATASIZE, null, __METHOD__, __LINE__);
    Severity: Major
    Found in src/DataType/TypeInteger.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return $context->setDataCheck('enum')->setValidationError(\SwaggerValidator\Common\Context::VALIDATION_TYPE_DATAVALUE, null, __METHOD__, __LINE__);
      Severity: Major
      Found in src/DataType/TypeInteger.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return $this->validateAllOf($context, $valueParams);
        Severity: Major
        Found in src/DataType/TypeCombined.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return $result;
          Severity: Major
          Found in src/DataType/TypeCombined.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return $this->loadRequestPath($paramName);
            Severity: Major
            Found in src/Common/Context.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return $this->loadRequestQuery($paramName);
              Severity: Major
              Found in src/Common/Context.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return $context->setValidationError(\SwaggerValidator\Common\Context::VALIDATION_TYPE_SWAGGER_ERROR, $keyOneOf . ' Combined Object Type cannot be empty !', __METHOD__, __LINE__);
                Severity: Major
                Found in src/DataType/TypeCombined.php - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language