YetiForceCompany/YetiForceCRM

View on GitHub
app/Mail/ScannerAction.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '34', column '17').
Open

        foreach ((new \DirectoryIterator(ROOT_DIRECTORY . self::$actionsDir)) as $fileinfo) {
Severity: Minor
Found in app/Mail/ScannerAction.php by phpmd

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

        return \App\Utils::flatten($actions);
Severity: Minor
Found in app/Mail/ScannerAction.php by phpmd

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

    public static function getActions(): array
    {
        $actions = [];
        foreach ((new \DirectoryIterator(ROOT_DIRECTORY . self::$actionsDir)) as $fileinfo) {
            if ('php' === $fileinfo->getExtension() && 'Base' !== ($fileName = $fileinfo->getBasename('.php'))) {
Severity: Minor
Found in app/Mail/ScannerAction.php by phpmd

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

    private static $actionsDir = '/app/Mail/ScannerAction';
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach ((new \DirectoryIterator(ROOT_DIRECTORY . self::$actionsDir)) as $fileinfo) {
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Get mail scanner actions.
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Mail scanner actions directory.
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @var string
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return array
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        ksort($actions);
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return \App\Utils::flatten($actions);
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $actions = [];
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function getActions(): array
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                $class = "App\\Mail\\ScannerAction\\{$fileName}";
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            }
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                $actions[$class::$priority][] = $fileName;
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            if ('php' === $fileinfo->getExtension() && 'Base' !== ($fileName = $fileinfo->getBasename('.php'))) {
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Mail/ScannerAction.php by phpcodesniffer

There are no issues that match your filters.

Category
Status