seregazhuk/php-pinterest-bot

View on GitHub

Showing 67 of 67 total issues

The class Pinners has 11 public methods. Consider refactoring Pinners to keep number of public methods under 10.
Open

class Pinners extends FollowableProvider
{
    use Searchable, ResolvesCurrentUser;

    /**
Severity: Minor
Found in src/Api/Providers/Pinners.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class Pins has 17 public methods. Consider refactoring Pins to keep number of public methods under 10.
Open

class Pins extends EntityProvider
{
    use Searchable,
        CanBeDeleted,
        SendsMessages,
Severity: Minor
Found in src/Api/Providers/Pins.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

Request has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class Request
{
    const DEFAULT_TOKEN = '1234';

    /**
Severity: Minor
Found in src/Api/Request.php - About 2 hrs to fix

    CurlHttpClient has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class CurlHttpClient implements HttpClient
    {
        /**
         * Custom CURL options for requests.
         *
    Severity: Minor
    Found in src/Api/CurlHttpClient.php - About 2 hrs to fix

      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

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

              $nameWithRemovedSpaces = str_replace(' ', '-', $board);
      Severity: Minor
      Found in src/Api/Providers/Boards.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

      Function processCallback has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function processCallback()
          {
              $this->resultsNum = 0;
              $this->processed = 0;
      
      
      Severity: Minor
      Found in src/Helpers/Pagination.php - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Avoid using short method names like User::id(). The configured minimum method name length is 3.
      Open

          public function id()
          {
              return $this->getProfileData('id');
          }
      Severity: Minor
      Found in src/Api/Providers/User.php by phpmd

      ShortMethodName

      Since: 0.2

      Detects when very short method names are used.

      Example

      class ShortMethod {
          public function a( $index ) { // Violation
          }
      }

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

      Avoid using short method names like Boards::my(). The configured minimum method name length is 3.
      Open

          public function my()
          {
              return $this->forMe();
          }
      Severity: Minor
      Found in src/Api/Providers/Boards.php by phpmd

      ShortMethodName

      Since: 0.2

      Detects when very short method names are used.

      Example

      class ShortMethod {
          public function a( $index ) { // Violation
          }
      }

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

      A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 36 and the first side effect is on line 3.
      Open

      <?php

      Method create has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function create($imageUrl, $boardId, $description = '', $link = '', $title = '', $sectionId = null)
      Severity: Minor
      Found in src/Api/Providers/Pins.php - About 45 mins to fix

        Method edit has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function edit($pindId, $description = '', $link = '', $boardId = null, $title = '', $sectionId = null)
        Severity: Minor
        Found in src/Api/Providers/Pins.php - About 45 mins to fix

          Method getRegistrationForm has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              protected function getRegistrationForm($email, $password, $name, $country, $age)
          Severity: Minor
          Found in src/Api/Providers/Auth.php - About 35 mins to fix

            Method fillRegistrationForm has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                protected function fillRegistrationForm($registrationForm, $password, $name, $country, $age)
            Severity: Minor
            Found in src/Api/Providers/Auth.php - About 35 mins to fix

              Method register has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function register($email, $password = null, $name = null, $country = 'GB', $age = 18)
              Severity: Minor
              Found in src/Api/Providers/Auth.php - About 35 mins to fix

                Missing class import via use statement (line '232', column '32').
                Open

                        $data['context'] = new \stdClass();
                Severity: Minor
                Found in src/Api/Request.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

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

                    public function getClientInfo($reload = false)
                Severity: Minor
                Found in src/Api/ProvidersContainer.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

                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

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

                    public function login($username, $password, $autoLogin = true)
                Severity: Minor
                Found in src/Api/Providers/Auth.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

                Missing class import via use statement (line '229', column '39').
                Open

                            $data = ['options' => new \stdClass()];
                Severity: Minor
                Found in src/Api/Request.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

                Severity
                Category
                Status
                Source
                Language