Function graphPath
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
public function graphPath($workflowName) {
//
// Defautl values.
$out = 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
Method graphPath
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function graphPath($workflowName) {
//
// Defautl values.
$out = false;
//
File WorkflowManager.php
has 325 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @file InteractiveConnector.php
* @author Alejandro Dario Simi
The class WorkflowManager has an overall complexity of 70 which is very high. The configured complexity threshold is 50. Open
class WorkflowManager extends \TooBasic\Managers\Manager {
//
// Protected properties.
/**
* @var \TooBasic\Adapters\DB\Adapter Database connection shortcut
- Exclude checks
Function CropImage
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
protected static function CropImage($path, $maxSize, &$data = null) {
//
// Default values.
$ok = 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 CropImage
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function CropImage($path, $maxSize, &$data = null) {
//
// Default values.
$ok = true;
//
Method inject
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function inject(Item $item, $workflowName, &$error = false) {
//
// Default values.
$out = true;
//
Function activeFlows
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function activeFlows($type = false, $id = false, $workflowName = false) {
//
// Retrieving the list of active flows from the representation
// factory.
$out = $this->representation->item_flows(false, 'TooBasic\\Workflows')->activeFlows();
- 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 inject
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function inject(Item $item, $workflowName, &$error = false) {
//
// Default values.
$out = 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 loadFactories
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function loadFactories() {
//
// Avoiding multipe loads.
if($this->_factories === 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
The method graphPath() has 187 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public function graphPath($workflowName) {
//
// Defautl values.
$out = false;
//
- Exclude checks
The method CropImage() has an NPath complexity of 756. The configured NPath complexity threshold is 200. Open
protected static function CropImage($path, $maxSize, &$data = null) {
//
// Default values.
$ok = true;
//
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
Remove error control operator '@' on line 602. Open
protected static function CropImage($path, $maxSize, &$data = null) {
//
// Default values.
$ok = true;
//
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Missing class import via use statement (line '146', column '18'). Open
$graph = new \Image_GraphViz();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Remove error control operator '@' on line 656. Open
protected static function CropImage($path, $maxSize, &$data = null) {
//
// Default values.
$ok = true;
//
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Remove error control operator '@' on line 108. Open
public function graphPath($workflowName) {
//
// Defautl values.
$out = false;
//
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
The method checkGraphsDirectories() contains an exit expression. Open
die;
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
Avoid unused parameters such as '$error'. Open
public function run(ItemFlowRepresentation $flow, &$error = false) {
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
The method checkGraphsDirectories() contains an exit expression. Open
die;
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
Avoid variables with short names like $id. Configured minimum length is 3. Open
public function activeFlows($type = false, $id = false, $workflowName = false) {
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $ok. Configured minimum length is 3. Open
$ok = true;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
public function injectDirect($type, $id, $workflowName, &$error = false) {
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}