Showing 129 of 129 total issues
Method configureWithOptions
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function configureWithOptions(array $options): self
{
foreach ($options as $name => $value) {
if (isset(static::THIS_SETS[$name])) {
$types = (array) static::THIS_SETS[$name];
The class Request has 52 public methods and attributes. Consider reducing the number of public items to less than 45. Open
class Request extends Prototype implements RequestInterface
{
use DebugDescriptionTrait;
protected const
- Read upRead up
- Exclude checks
ExcessivePublicCount
Since: 0.1
A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.
Example
public class Foo {
public $value;
public $something;
public $var;
// [... more more public attributes ...]
public function doWork() {}
public function doMoreWork() {}
public function doWorkAgain() {}
// [... more more public methods ...]
}
Source https://phpmd.org/rules/codesize.html#excessivepubliccount
Function getContentOptions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function getContentOptions(ResourceManagerInterface $resourceManager, string $contentType): array
{
$contentType = strstr($contentType, ';', true);
if (in_array($contentType, static::FORM_MIME_TYPES)) {
- 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 produce
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function produce(string $key, array $options, string $name)
{
// CamelCase tags
$length = strlen($key);
$index = $this->keyPrefixLength;
Method addCompare
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function addCompare(string $join, bool $positive, $left, string $operator, $right, string $leftType, string $rightType): void
The property $__config is not named in camelCase. Open
class ConfigValues extends AbstractHelper
{
/**
* @var ContainerInterface
*/
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The parameter $__filename is not named in camelCase. Open
public static function include(AssistantInterface $_, string $__filename, array $__data): void
{
// Extract data
extract($__data, EXTR_SKIP);
unset($__data);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $__data is not named in camelCase. Open
public static function include(AssistantInterface $_, string $__filename, array $__data): void
{
// Extract data
extract($__data, EXTR_SKIP);
unset($__data);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $_ is not named in camelCase. Open
public static function include(AssistantInterface $_, string $__filename, array $__data): void
{
// Extract data
extract($__data, EXTR_SKIP);
unset($__data);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
Method addRouteParameterSegment
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function addRouteParameterSegment(string $name, array $segments, array $path, string $uri, array $parameters, int $level): void
Method processFiles
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function processFiles(ResourceManagerInterface $resourceManager, $name, $type, $tempFilename, $error, $size): ?array
Method addJoin
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function addJoin(string $type, RepositoryInterface $repository, string $left, string $operator, $right, string $alias = null): void
The class Stream has a coupling between objects value of 17. Consider to reduce the number of dependencies under 13. Open
class Stream implements StreamInterface
{
protected const
INVALID_STREAM_EXCEPTION = 'Invalid stream',
INVALID_STREAM_REFERENCE_EXCEPTION = 'Invalid stream reference',
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
The class AbstractGrammar has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13. Open
abstract class AbstractGrammar extends Resource implements GrammarInterface
{
protected const
ALIAS_MASK = '%s AS %s',
ARRAY_MASK = '(%s)',
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
The class Repository has a coupling between objects value of 19. Consider to reduce the number of dependencies under 13. Open
class Repository extends Resource implements RepositoryInterface
{
protected const
ENTITY_ID_PROTOTYPE = '*\Model\Entity\EntityId',
ENTITY_REFRESH_FAILURE_EXCEPTION = 'Entity refresh error',
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Method leftJoin
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function leftJoin(RepositoryInterface $repository, string $left, string $operator, $right, string $alias = null): RequestInterface
Method join
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function join(RepositoryInterface $repository, string $left, string $operator, $right, string $alias = null): RequestInterface;
Method leftJoin
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function leftJoin(RepositoryInterface $repository, string $left, string $operator, $right, string $alias = null): RequestInterface;
Method orCompare
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function orCompare($left, string $operator, $right, string $leftType = self::TYPE_IDENTIFIER, string $rightType = self::TYPE_VALUE): WhereInterface
Method addRouteSegments
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function addRouteSegments(array $segments, array $path, string $uri, array $parameters, int $level): void