File FactorySwagger.php
has 327 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* Copyright 2016 Nicolas JUHEL <swaggervalidator@nabbar.com>.
*
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"
Further reading
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;
- 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 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(
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])) {
Method SecurityDefinition
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function SecurityDefinition(\SwaggerValidator\Common\Context $context, &$jsonData)
{
$typeKey = self::KEY_TYPE;
$flowKey = self::KEY_FLOW;
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;
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)
Avoid too many return
statements within this method. Open
return $this->buildPrimitive($context, $originType, $originKey, $jsonData);
Avoid too many return
statements within this method. Open
return 'TypeNumber';
Avoid too many return
statements within this method. Open
return \SwaggerValidator\Common\Factory::getInstance()->OAuth2ApplicationSecurity;
Avoid too many return
statements within this method. Open
return 'TypeObject';
Avoid too many return
statements within this method. Open
return $this->returnBuildObject($context, \SwaggerValidator\Common\Factory::getInstance()->Reference, $originType, $originKey, $jsonData);
Avoid too many return
statements within this method. Open
return $jsonData;
Avoid too many return
statements within this method. Open
return $this->returnBuildObject($context, \SwaggerValidator\Common\Factory::getInstance()->TypeObject, $originType, $originKey, $jsonData);
Avoid too many return
statements within this method. Open
return 'TypeString';
Avoid too many return
statements within this method. Open
return $jsonData;
Avoid too many return
statements within this method. Open
return \SwaggerValidator\Common\Factory::getInstance()->OAuth2AccessCodeSecurity;