Showing 188 of 604 total issues
File Swagger.php
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* Copyright 2016 Nicolas JUHEL <swaggervalidator@nabbar.com>.
*
Function setValidationError
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function setValidationError($valitionType, $messageException = null, $method = null, $line = null)
{
$this->logValidationError($valitionType, $messageException, $method, $line);
if ($this->__get('IsCombined')) {
- Read upRead up
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 getExampleType
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getExampleType(\SwaggerValidator\Common\Context $context)
{
$keyItems = \SwaggerValidator\Common\FactorySwagger::KEY_ITEMS;
if (is_object($this->$keyItems) && method_exists($this->$keyItems, 'getModel')) {
Method validate
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validate(\SwaggerValidator\Common\Context $context)
{
$keyRequired = \SwaggerValidator\Common\FactorySwagger::KEY_REQUIRED;
$keyAdditional = \SwaggerValidator\Common\FactorySwagger::KEY_ADDPROPERTIES;
Method getModel
has 50 lines of code (exceeds 25 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;
Method validate
has 48 lines of code (exceeds 25 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;
Function validate
has a Cognitive Complexity of 15 (exceeds 5 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__);
}
- Read upRead up
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 getExampleType
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function getExampleType(\SwaggerValidator\Common\Context $context)
{
$keySchema = \SwaggerValidator\Common\FactorySwagger::KEY_SCHEMA;
$result = array();
- Read upRead up
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 loadRequestPath
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function loadRequestPath($paramName)
{
// parse from the end to the top
$path = array_reverse(explode('/', $this->contextRequestPath));
- Read upRead up
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 getExampleType
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function getExampleType(\SwaggerValidator\Common\Context $context)
{
$keyItems = \SwaggerValidator\Common\FactorySwagger::KEY_ITEMS;
if (is_object($this->$keyItems) && method_exists($this->$keyItems, 'getModel')) {
- Read upRead up
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 jsonUnSerialize
has 45 lines of code (exceeds 25 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) {
Function validate
has a Cognitive Complexity of 14 (exceeds 5 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__);
}
- Read upRead up
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 14 (exceeds 5 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;
- Read upRead up
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 __construct
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(\SwaggerValidator\Common\Context $context, $filepath)
{
$this->fileUri = $filepath;
$urlPart = parse_url($filepath);
- Read upRead up
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 getExampleType
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getExampleType(\SwaggerValidator\Common\Context $context)
{
$keySchema = \SwaggerValidator\Common\FactorySwagger::KEY_SCHEMA;
$result = array();
Consider simplifying this complex logical expression. Open
if ($paramName === \SwaggerValidator\Common\FactorySwagger::LOCATION_BODY && $this->getType() === self::TYPE_REQUEST) {
return $this->loadRequestBody();
}
elseif ($paramName === \SwaggerValidator\Common\FactorySwagger::LOCATION_BODY && $this->getType() === self::TYPE_RESPONSE) {
return $this->loadResponseBody();
Method buildBodyXml
has 40 lines of code (exceeds 25 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);
Method buildObjectFromOriginObject
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function buildObjectFromOriginObject(\SwaggerValidator\Common\Context $context, $originType, $originKey, &$jsonData)
{
$keyIn = self::KEY_IN;
$keyName = self::KEY_NAME;
$object = null;
Function buildObjectFromOriginKey
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function buildObjectFromOriginKey(\SwaggerValidator\Common\Context $context, $originType, $originKey, &$jsonData)
{
$object = null;
if (!empty(self::$keyToObject[$originKey])) {
- Read upRead up
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 13 (exceeds 5 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(
- Read upRead up
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"