app/Mail/ScannerAction.php
Missing class import via use statement (line '34', column '17'). Open
Open
foreach ((new \DirectoryIterator(ROOT_DIRECTORY . self::$actionsDir)) as $fileinfo) {
- 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 using static access to class '\App\Utils' in method 'getActions'. Open
Open
return \App\Utils::flatten($actions);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid assigning values to variables in if clauses and the like (line '35', column '59'). Open
Open
public static function getActions(): array
{
$actions = [];
foreach ((new \DirectoryIterator(ROOT_DIRECTORY . self::$actionsDir)) as $fileinfo) {
if ('php' === $fileinfo->getExtension() && 'Base' !== ($fileName = $fileinfo->getBasename('.php'))) {
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Spaces must be used to indent lines; tabs are not allowed Open
Open
private static $actionsDir = '/app/Mail/ScannerAction';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
foreach ((new \DirectoryIterator(ROOT_DIRECTORY . self::$actionsDir)) as $fileinfo) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Get mail scanner actions.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Mail scanner actions directory.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
ksort($actions);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return \App\Utils::flatten($actions);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$actions = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public static function getActions(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$class = "App\\Mail\\ScannerAction\\{$fileName}";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$actions[$class::$priority][] = $fileName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ('php' === $fileinfo->getExtension() && 'Base' !== ($fileName = $fileinfo->getBasename('.php'))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks