autowp/external-login-service

View on GitHub

Showing 72 of 72 total issues

Function getFriends has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFriends(): array
    {
        if (! $this->accessToken) {
            throw new ExternalLoginServiceException("Access token not provided");
        }
Severity: Minor
Found in src/Facebook.php - About 2 hrs 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

Function getData has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function getData(array $options): Result
    {
        $provider = $this->getProvider();

        $ownerDetails = $provider->getResourceOwner($this->accessToken);
Severity: Minor
Found in src/GooglePlus.php - About 2 hrs 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

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

class Result
{
    /** @var string */
    private string $externalId;

Severity: Minor
Found in src/Result.php - About 2 hrs to fix

    Method getData has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getData(array $options): Result
        {
            $provider = $this->getProvider();
    
            $ownerDetails = $provider->getResourceOwner($this->accessToken);
    Severity: Minor
    Found in src/Facebook.php - About 1 hr to fix

      Method getData has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getData(array $options): Result
          {
              $provider = $this->getProvider();
      
              $ownerDetails = $provider->getResourceOwner($this->accessToken);
      Severity: Minor
      Found in src/GooglePlus.php - About 1 hr to fix

        Method getFriends has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getFriends(): array
            {
                if (! $this->accessToken) {
                    throw new ExternalLoginServiceException("Access token not provided");
                }
        Severity: Minor
        Found in src/Facebook.php - About 1 hr to fix

          Method getData has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getData(array $options): Result
              {
                  $provider = $this->getProvider();
          
                  if (isset($options['language'])) {
          Severity: Minor
          Found in src/Vk.php - About 1 hr to fix

            Method getData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getData(array $options): Result
                {
                    $clientIDs = preg_split("/[[:space:]]+/isu", $this->options['clientId']);
            
                    foreach ($clientIDs as $clientID) {
            Severity: Minor
            Found in src/Google.php - About 1 hr to fix

              Function getData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getData(array $options): Result
                  {
                      $provider = $this->getProvider();
              
                      $ownerDetails = $provider->getResourceOwner($this->accessToken);
              Severity: Minor
              Found in src/Facebook.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

              Function getFriends has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getFriends(): array
                  {
                      $cursor    = - 1;
                      $friendsId = [];
                      $count     = 1000;
              Severity: Minor
              Found in src/Twitter.php - About 55 mins 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

              Function getData has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getData(array $options): Result
                  {
                      $clientIDs = preg_split("/[[:space:]]+/isu", $this->options['clientId']);
              
                      foreach ($clientIDs as $clientID) {
              Severity: Minor
              Found in src/Google.php - About 55 mins 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 classes with short names like Vk. Configured minimum length is 3.
              Open

              class Vk extends AbstractLeagueOAuth2
              {
                  protected function createProvider(): VkProvider
                  {
                      return new VkProvider([
              Severity: Minor
              Found in src/Vk.php by phpmd

              ShortClassName

              Since: 2.9

              Detects when classes or interfaces have a very short name.

              Example

              class Fo {
              
              }
              
              interface Fo {
              
              }

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

              Function getData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getData(array $options): Result
                  {
                      $provider = $this->getProvider();
              
                      if (isset($options['language'])) {
              Severity: Minor
              Found in src/Vk.php - About 45 mins 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 static access to class '\Laminas\Uri\UriFactory' in method 'removeSizeParam'.
              Open

                      $uri = UriFactory::factory($url);
              Severity: Minor
              Found in src/GooglePlus.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 '\Laminas\Uri\UriFactory' in method 'setSizeParam'.
              Open

                      $uri = UriFactory::factory($url);
              Severity: Minor
              Found in src/Google.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 '\Laminas\Json\Json' in method 'getFriends'.
              Open

                              $response = Json\Json::decode($response);
              Severity: Minor
              Found in src/Facebook.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 getData() has an NPath complexity of 972. The configured NPath complexity threshold is 200.
              Open

                  public function getData(array $options): Result
                  {
                      $provider = $this->getProvider();
              
                      if (isset($options['language'])) {
              Severity: Minor
              Found in src/Vk.php by phpmd

              NPathComplexity

              Since: 0.1

              The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

              Example

              class Foo {
                  function bar() {
                      // lots of complicated code
                  }
              }

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

              The method getData() has an NPath complexity of 19683. The configured NPath complexity threshold is 200.
              Open

                  public function getData(array $options): Result
                  {
                      $provider = $this->getProvider();
              
                      $ownerDetails = $provider->getResourceOwner($this->accessToken);
              Severity: Minor
              Found in src/Facebook.php by phpmd

              NPathComplexity

              Since: 0.1

              The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

              Example

              class Foo {
                  function bar() {
                      // lots of complicated code
                  }
              }

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

              Avoid using static access to class '\DateTime' in method 'getData'.
              Open

                          $data['birthday'] = DateTime::createFromFormat('m/d/Y', $json['birthday']);
              Severity: Minor
              Found in src/Facebook.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 unused parameters such as '$params'.
              Open

                  public function callback(array $params): array
              Severity: Minor
              Found in src/Google.php by phpmd

              UnusedFormalParameter

              Since: 0.2

              Avoid passing parameters to methods or constructors and then not using those parameters.

              Example

              class Foo
              {
                  private function bar($howdy)
                  {
                      // $howdy is not used
                  }
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

              Severity
              Category
              Status
              Source
              Language