YetiForceCompany/YetiForceCRM

View on GitHub
app/Fields/TimePeriod.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Avoid using static access to class '\App\Language' in method 'getLabel'.
Open

        return $time[0] . ' ' . \App\Language::translate(static::$unitLabels[$time[1]]);
Severity: Minor
Found in app/Fields/TimePeriod.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

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

     * @var array
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

     * @return int
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

                break;
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

     * Get time period label.
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

    public static function getLabel(string $value)
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

    public static $unitLabels = [
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

        $multiplier = 1;
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

            case 'H':
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

        [$number,$timePeriod] = explode(':', $value);
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

        'd' => 'LBL_DAYS',
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

                break;
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

     * Unit labels.
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

        'H' => 'LBL_HOURS',
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

        }
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

        $time = explode(':', $value);
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

    ];
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

            case 'd':
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

                $multiplier = 60 * 24;
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

            default:
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

     * Convert to minutes.
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

        switch ($timePeriod) {
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

    public static function convertToMinutes(string $value): int
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

     * @param string $value
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

                $multiplier = 60;
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

        'i' => 'LBL_MINUTES',
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

     * @param string $value
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

        return $number * $multiplier;
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

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

        return $time[0] . ' ' . \App\Language::translate(static::$unitLabels[$time[1]]);
Severity: Minor
Found in app/Fields/TimePeriod.php by phpcodesniffer

There are no issues that match your filters.

Category
Status