Showing 188 of 604 total issues
Method validate
has 31 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__);
}
Method jsonUnSerialize
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function jsonUnSerialize(\SwaggerValidator\Common\Context $context, $jsonData)
{
parent::checkJsonObject($context, $jsonData);
if (count(get_object_vars($jsonData)) > 1) {
Method loadBodyByContent
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function loadBodyByContent($headers, $rawBody)
{
$contentType = null;
$contentLength = null;
Method validate
has 29 lines of code (exceeds 25 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;
Method autoload
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
final public static function autoload($className)
{
if (\Phar::running() && defined('PHAR_SWAGGER_VALIDATOR_ROOT_PATH')) {
$baseDir = PHAR_SWAGGER_VALIDATOR_ROOT_PATH;
}
Method validate
has 29 lines of code (exceeds 25 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__);
}
Method random_int
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function random_int($min, $max)
{
if (!is_int($min) || !is_int($max)) {
trigger_error('$min and $max must be integer values', E_USER_NOTICE);
$min = (int) $min;
Method formatModel
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function formatModel(\SwaggerValidator\Common\Context $context, $value)
{
$keyIn = \SwaggerValidator\Common\FactorySwagger::KEY_IN;
$keyType = \SwaggerValidator\Common\FactorySwagger::KEY_IN;
Method loadRequestPath
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function loadRequestPath($paramName)
{
// parse from the end to the top
$path = array_reverse(explode('/', $this->contextRequestPath));
Method setLocation
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setLocation($value = null)
{
switch (strtolower($value)) {
case \SwaggerValidator\Common\FactorySwagger::LOCATION_BODY:
case 'body':
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;
Function validateOneOf
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function validateOneOf(\SwaggerValidator\Common\Context $context, $valueParams = null)
{
$keyOneOf = \SwaggerValidator\Common\FactorySwagger::KEY_ONEOF;
$check = false;
$result = false;
- 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 format
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function format(\SwaggerValidator\Common\Context $context, $valueParams)
{
if (!isset($this->format)) {
return true;
}
- 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 random_int
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function random_int($min, $max)
{
if (!is_int($min) || !is_int($max)) {
trigger_error('$min and $max must be integer values', E_USER_NOTICE);
$min = (int) $min;
- 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 autoload
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
final public static function autoload($className)
{
if (\Phar::running() && defined('PHAR_SWAGGER_VALIDATOR_ROOT_PATH')) {
$baseDir = PHAR_SWAGGER_VALIDATOR_ROOT_PATH;
}
- 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 getModel
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getModel(\SwaggerValidator\Common\Context $context, $listParameters)
{
foreach ($this->keys() as $key) {
if (!preg_match('/^([0-9]{3})$|^(default)$/', $key) || !is_object($this->$key) || !($this->$key instanceof \SwaggerValidator\Object\ResponseItem)) {
- 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 set
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function set(\SwaggerValidator\Common\Context $context, $ref, $value = null)
{
$id = self::getIdFromRef($context, $ref);
if ($id == $ref) {
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
public function validate(\SwaggerValidator\Common\Context $context)
{
foreach ($this->keys() as $key) {
if (is_object($this->$key) && ($this->$key instanceof \SwaggerValidator\Object\Operation)) {
continue;
- 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 checkProduce
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function checkProduce(\SwaggerValidator\Common\Context $context)
{
if (!isset($this->produces)) {
return true;
}
- 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 getModel
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getModel(\SwaggerValidator\Common\Context $context, $generalItems = array())
{
$result = array();
$generalItems = $this->getMethodGeneric($context, __FUNCTION__, $generalItems);
- 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"