File BaseSpecs.php
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace luya\admin\openapi\specs;
use cebe\openapi\spec\Example;
Method getParameters
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getParameters(): array
{
$params = [];
if ($this->getReflection() instanceof ReflectionMethod) {
foreach ($this->getReflection()->getParameters() as $arg) {
Method getResponseContent
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getResponseContent()
{
$modelClass = $this->extractModelClassFromObject($this->getActionObject());
if ($modelClass) {
Function getParameters
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getParameters(): array
{
$params = [];
if ($this->getReflection() instanceof ReflectionMethod) {
foreach ($this->getReflection()->getParameters() as $arg) {
- 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 internalGenerateResponseArrayFromModel
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function internalGenerateResponseArrayFromModel($modelClassName, $isArray = false)
{
$object = $this->createObjectFromClassName($modelClassName);
$schema = false;
Function internalGenerateResponseArrayFromModel
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function internalGenerateResponseArrayFromModel($modelClassName, $isArray = false)
{
$object = $this->createObjectFromClassName($modelClassName);
$schema = 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
Avoid too many return
statements within this method. Open
return [];
Avoid too many return
statements within this method. Open
return [
'application/json' => new MediaType([
'schema' => [
'type' => $type->getNoramlizeName(),
],
Avoid too many return
statements within this method. Open
return [
'application/json' => new MediaType([
'schema' => [
'type' => 'object',
],
Function getResponseContent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getResponseContent()
{
$modelClass = $this->extractModelClassFromObject($this->getActionObject());
if ($modelClass) {
- 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"