Showing 227 of 227 total issues
Expected 1 space after FUNCTION keyword; 0 found Open
function(Node $node) {
- Exclude checks
Function assertCall
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function assertCall($methodName, array $arguments)
{
if (!isset($this->methodCallAsserts[$methodName])) {
return 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
There must be one blank line after the last USE statement; 0 found; Open
use PAGI\CallSpool\Impl\CallSpoolImpl;
- Exclude checks
Expected 1 space after FUNCTION keyword; 0 found Open
function(Node $node) {
- Exclude checks
Multi-line function declarations must define one parameter per line Open
NodeController $nodeController, \Closure $onInit
- Exclude checks
Expected 1 space after FUNCTION keyword; 0 found Open
function(Node $node) {
- Exclude checks
Expected 1 space after FUNCTION keyword; 0 found Open
function(Node $node) {
- Exclude checks
Expected 1 blank line at end of file; 2 found Open
}
- Exclude checks
Expected 1 space after FUNCTION keyword; 0 found Open
function(Node $node) {
- Exclude checks
Expected 1 space after FUNCTION keyword; 0 found Open
function(Node $node) {
- Exclude checks
Avoid too many return
statements within this method. Open
return false;
Remove error control operator '@' on line 97. Open
public function spool(CallFile $call, $schedule = null)
{
$filename = tempnam($this->tmpDir, 'PAGICallFile');
if ($filename === false) {
throw new CallSpoolException('Could generate temporary filename');
- 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 118. Open
public function spool(CallFile $call, $schedule = null)
{
$filename = tempnam($this->tmpDir, 'PAGICallFile');
if ($filename === false) {
throw new CallSpoolException('Could generate temporary filename');
- 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 setMusic has a boolean flag argument $class, which is a certain sign of a Single Responsibility Principle violation. Open
public function setMusic($enable, $class = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getFullVariable has a boolean flag argument $channel, which is a certain sign of a Single Responsibility Principle violation. Open
public function getFullVariable($name, $channel = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '543', column '35'). Open
$this->nodes[$name] = new \PAGI\Node\MockedNode();
- 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
Avoid too many return
statements within this method. Open
return "max valid input attempts reached";
Remove error control operator '@' on line 101. Open
public function spool(CallFile $call, $schedule = null)
{
$filename = tempnam($this->tmpDir, 'PAGICallFile');
if ($filename === false) {
throw new CallSpoolException('Could generate temporary filename');
- 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 record has a boolean flag argument $silence, which is a certain sign of a Single Responsibility Principle violation. Open
public function record($file, $format, $escapeDigits, $maxRecordTime = -1, $silence = false);
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Avoid too many return
statements within this method. Open
return 'Line is busy';