seregazhuk/php-pinterest-bot

View on GitHub
src/Api/Providers/Core/Provider.php

Summary

Maintainability
A
0 mins
Test Coverage

The method post has a boolean flag argument $returnData, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function post($resourceUrl, array $requestOptions = [], $returnData = false)
Severity: Minor
Found in src/Api/Providers/Core/Provider.php by phpmd

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 assigning values to variables in if clauses and the like (line '120', column '47').
Open

    protected function requiresLoginFor()
    {
        $loginRequired = [];

        foreach (class_parents($this) + class_uses_recursive($this) as $traitOrParent) {
Severity: Minor
Found in src/Api/Providers/Core/Provider.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

Avoid excessively long variable names like $methodsThatRequireLogin. Keep variable name length under 20.
Open

        $methodsThatRequireLogin = array_merge($this->loginRequiredFor, $this->requiresLoginFor());
Severity: Minor
Found in src/Api/Providers/Core/Provider.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Only one argument is allowed per line in a multi-line function call
Open

            $requestOptions, $this->response->getBookmarks()

There are no issues that match your filters.

Category
Status