Showing 176 of 176 total issues
The class GenericCollection has 15 public methods. Consider refactoring GenericCollection to keep number of public methods under 10. Open
class GenericCollection implements CollectionInterface, \IteratorAggregate
{
/**
* @var array The source data.
*/
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
Function __construct
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(array $options)
{
$this->route = [
"plugins" => [
"deserializer" => DeserializerPlugin::class,
- 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 definedAs
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function &definedAs(array $columns) : SQLWrapperInterface
{
//mysql wants PRIMARY KEY(...) after column definitions
$primaryKeyName = '';
- 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 definedAs
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function &definedAs(array $columns) : SQLWrapperInterface
{
$this->appendToQuery('(');
$first = 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 deserialize
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function deserialize($message, $format = self::JSON)
{
if ((is_array($message)) || ($message instanceof CollectionInterface)) {
return new self($message);
} elseif ($format === self::JSON) {
- 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 definedAs
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function &definedAs(array $columns) : SQLWrapperInterface
{
//mysql wants PRIMARY KEY(...) after column definitions
$primaryKeyName = '';
Method __construct
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(array $options)
{
$this->route = [
"plugins" => [
"deserializer" => DeserializerPlugin::class,
Consider simplifying this complex logical expression. Open
if (($relation != FieldRelation::EQUAL) &&
($relation != FieldRelation::NOT_EQUAL) &&
($relation != FieldRelation::LESS_THAN) &&
($relation != FieldRelation::LESS_OR_EQUAL_THAN) &&
($relation != FieldRelation::GREATER_THAN) &&
Method definedAs
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function &definedAs(array $columns) : SQLWrapperInterface
{
$this->appendToQuery('(');
$first = true;
Function definedAs
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function &definedAs(array $columns) : SQLWrapperInterface
{
$this->appendToQuery('(');
$first = 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
Method loadErrorHandlers
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function loadErrorHandlers($method) : array
{
$errorHandlers = [];
foreach ($this->routes[$method] as &$currentRoute) {
Method definedAs
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function &definedAs(array $columns) : SQLWrapperInterface
{
$this->appendToQuery('(');
$first = true;
Method deserialize
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function deserialize($message, $format = self::JSON)
{
if ((is_array($message)) || ($message instanceof CollectionInterface)) {
return new self($message);
} elseif ($format === self::JSON) {
Function fromMixed
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function fromMixed($mixed, \DOMElement $domElement = null)
{
$domElement = is_null($domElement) ? $this : $domElement;
if (is_array($mixed)) {
- 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 parsePDOConnectionQuery
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function parsePDOConnectionQuery($connection)
{
$rawParams = [];
$paramSplit = explode(';', $connection);
- 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 initTransitionSchema
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function initTransitionSchema()
{
//table must have been already correctly parsed, so I know data is well-formed
if (!ActiveRecordTables::isRegistered(static::class)) {
throw new ActiveRecordException("Table definition for the current ActiveRecord object is missing.", 300);
Function initialize
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function initialize($init = null)
{
if ((!is_null($init)) && (!is_array($init))) {
throw new \InvalidArgumentException('The initialization filter con only be null or a valid 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 matchCheck
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected static function matchCheck($uriSplit, $urlSplit, array &$params) : bool
{
$result = false;
if ((strlen($uriSplit) >= 7) && ($uriSplit[0] == '{') && ($uriSplit[strlen($uriSplit) - 1] == '}')) {
- 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 where
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function &where(SelectionCriteria $where) : SQLWrapperInterface
{
//execute the private function 'export'
$exportMethod = new \ReflectionMethod($where, 'export');
$exportMethod->setAccessible(true);
Method parsePDOConnectionQuery
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function parsePDOConnectionQuery($connection)
{
$rawParams = [];
$paramSplit = explode(';', $connection);