timegridio/concierge

View on GitHub

Showing 85 of 85 total issues

Avoid using static access to class '\Carbon\Carbon' in method 'scopeFuture'.
Open

            $since = Carbon::now();
Severity: Minor
Found in src/Models/Vacancy.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

The method cast uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    return unserialize($value);
                }
Severity: Minor
Found in src/Traits/Preferenceable.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid using static access to class '\Carbon\Carbon' in method 'processServiceStatements'.
Open

            $vacancy = $business->vacancies()->forDate(Carbon::parse($date))->forService($service->id);
Severity: Minor
Found in src/Vacancy/VacancyManager.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 using static access to class '\Carbon\Carbon' in method 'makeDateTime'.
Open

        return Carbon::parse("{$date} {$time} {$timezone}");
Severity: Minor
Found in src/Concierge.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 '220', column '13').
Open

    public function getEmailAttribute()
    {
        if ($email = array_get($this->attributes, 'email')) {
            return $email;
        }
Severity: Minor
Found in src/Models/Contact.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

The variable $first_interval is not named in camelCase.
Open

    public function __construct($interval = 0)
    {
        if ($interval instanceof \DateTime) {
            $first_interval = strtotime($interval->format('Y-m-d H:i:s'));
            $last_interval = strtotime($interval->format('Y-m-d H:i:s'));
Severity: Minor
Found in src/Duration.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $last_interval is not named in camelCase.
Open

    public function __construct($interval = 0)
    {
        if ($interval instanceof \DateTime) {
            $first_interval = strtotime($interval->format('Y-m-d H:i:s'));
            $last_interval = strtotime($interval->format('Y-m-d H:i:s'));
Severity: Minor
Found in src/Duration.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $round_method is not named in camelCase.
Open

    public function getHours($round_method = null)
    {
        $result = $this->interval / (1000 * 60 * 60);

        return $this->round($result, $round_method);
Severity: Minor
Found in src/Duration.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $calendar_link is not named in camelCase.
Open

    public function setCalendarLinkAttribute($calendar_link)
    {
        return $this->attributes['calendar_link'] = trim($calendar_link) ?: null;
    }
Severity: Minor
Found in src/Models/Humanresource.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $first_interval is not named in camelCase.
Open

    public function __construct($interval = 0)
    {
        if ($interval instanceof \DateTime) {
            $first_interval = strtotime($interval->format('Y-m-d H:i:s'));
            $last_interval = strtotime($interval->format('Y-m-d H:i:s'));
Severity: Minor
Found in src/Duration.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $last_interval is not named in camelCase.
Open

    public function __construct($interval = 0)
    {
        if ($interval instanceof \DateTime) {
            $first_interval = strtotime($interval->format('Y-m-d H:i:s'));
            $last_interval = strtotime($interval->format('Y-m-d H:i:s'));
Severity: Minor
Found in src/Duration.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $round_method is not named in camelCase.
Open

    private function round($result, $round_method = null)
    {
        if ($round_method === PHP_ROUND_HALF_UP) {
            $result = ceil($result);
        } elseif ($round_method === PHP_ROUND_HALF_DOWN) {
Severity: Minor
Found in src/Duration.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $round_method is not named in camelCase.
Open

    private function round($result, $round_method = null)
    {
        if ($round_method === PHP_ROUND_HALF_UP) {
            $result = ceil($result);
        } elseif ($round_method === PHP_ROUND_HALF_DOWN) {
Severity: Minor
Found in src/Duration.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $round_method is not named in camelCase.
Open

    public function getSeconds($round_method = null)
    {
        $result = $this->interval / 1000;

        return $this->round($result, $round_method);
Severity: Minor
Found in src/Duration.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $round_method is not named in camelCase.
Open

    public function getMinutes($round_method = null)
    {
        $result = $this->interval / (1000 * 60);

        return $this->round($result, $round_method);
Severity: Minor
Found in src/Duration.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The method array_set is not named in camelCase.
Open

    private function array_set(&$array, $key, $value)
    {
        return Arr::set($array, $key, $value);
    }
Severity: Minor
Found in src/Timetable/Timetable.php by phpmd

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method array_get is not named in camelCase.
Open

    private function array_get($array, $key, $default = null)
    {
        return Arr::get($array, $key, $default);
    }
Severity: Minor
Found in src/Timetable/Timetable.php by phpmd

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method array_substitute is not named in camelCase.
Open

    private function array_substitute(&$array1, $array2)
    {
        foreach ($array1 as $key => $value) {
            $array1[$key] = $array2[$value];
        }
Severity: Minor
Found in src/Timetable/Timetable.php by phpmd

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

TODO found
Open

            // TODO: Log failure feedback message / raise exception
Severity: Minor
Found in src/Concierge.php by fixme

TODO found
Open

     * TODO: Check slug setting can be moved to a more proper place.
Severity: Minor
Found in src/Models/ServiceType.php by fixme
Severity
Category
Status
Source
Language