Showing 452 of 452 total issues
Method extractAffix
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function extractAffix($propertyName, $invert = false)
{
$parts = [];
// Look for special non-alphanumeric affixes
preg_match('/^([!=<>%#]*)([^!=<>%#]+)([!=<>%#]*)$/', $propertyName, $parts);
Function unique
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function unique()
{
$copy = $this->container;
$clobberlist = [];
$modelclobberlist = [];
- 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 __call
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function __call($name, $args)
{
// If we use Model::COUNT_ONLY on empty container, return 0
if (count($this->container) == 0 && is_numeric($args[1]) && ($args[1] & Model::COUNT_ONLY)) {
return 0;
- 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 generateData
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generateData($connection)
{
list($schema, $database) = $connection->getSchemaGenerator()->generate();
$currentTable = null;
Method generateTableList
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function generateTableList(Data $datastore)
{
$data = $datastore->data;
foreach(preg_split('~[\r\n]+~', $data) as $line) {
if (empty($line) or ctype_space($line)) {
Method groupJoinM2M
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function groupJoinM2M(Collection $collection, $var, $where, $countOnly = false)
{
$results = new Collection();
$proto = $collection[0]->_data;
Avoid using short method names like Join::on(). The configured minimum method name length is 3. Open
public function on(array $clauses) : self
{
$this->where->addOnClauses($clauses);
return $this;
}
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Method resolve
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function resolve() : array
{
$this->data = [];
$table = $this->table->render($this);
Method commit
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function commit()
{
// Determine the type of SQL instruction to run
if ($this->delete) {
$mode = 'delete';
Method factoryObjectCache
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
final public static function factoryObjectCache($ids, $classOrTable = null, Schema $schema = null, $forceRefresh = false)
{
$schema = $schema ?: Schema::get(static::getNamespace());
list(,$table) = $schema->guessContext($classOrTable ?: get_called_class());
$namespace = $schema->namespace;
Method getFullTree
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFullTree()
{
$table = $this->closureTable;
// Find the root node from the supplied node_id
Avoid using undefined variables such as '$clauses' which will lead to PHP notices. Open
$query->where($clauses);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$return' which will lead to PHP notices. Open
$return[] = [
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$clauses' which will lead to PHP notices. Open
$clauses['`pivotjoin`.`' . $clauseColumn . '`' . $prefix] = $clauseValue;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$clauses' which will lead to PHP notices. Open
if ($clauses) {
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$return' which will lead to PHP notices. Open
return $return;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$this' which will lead to PHP notices. Open
$output .= " <span><strong>connection</strong></span> => ".$this->connection->name."\n";
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$this' which will lead to PHP notices. Open
$value = $this->_data->$key;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$instance' which will lead to PHP notices. Open
Model::$instance[$this->namespace][$this->table][strtolower(get_called_class())][$this->id] = $this;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$external' which will lead to PHP notices. Open
$obj->_data->external[$var] = new Collection((array) $external[$obj->id]);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}