Showing 7 of 9 total issues
File Component.php
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace BootPress\Hierarchy;
use BootPress\Database\Component as Database;
Method tree
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function tree($column, $field = null, $value = null, $having = null)
{
$tree = array();
if (func_num_args() >= 3) {
$depth = (is_string($having) && strpos($having, 'depth') !== false) ? ' HAVING '.$having : null;
Function nestify
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function nestify(array $tree)
{
$nested = array();
$children = array();
foreach ($tree as $id => $fields) {
- 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 counts
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function counts($table, $match, $id = null)
{
if (!is_null($id)) {
return (int) $this->db->value(array(
'SELECT COUNT('.$table.'.'.$match.') AS count',
Function refresh
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function refresh($order = null)
{
if (is_null($order)) {
$order = $this->id;
}
- 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 counts
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function counts($table, $match, $id = null)
{
if (!is_null($id)) {
return (int) $this->db->value(array(
'SELECT COUNT('.$table.'.'.$match.') AS count',
- 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 flatten
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function flatten(array $nest, array $related = array())
{
$children = array();
foreach ($nest as $id => $values) {
$parents = $related;
- 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"