SU-SWS/stanford_person

View on GitHub
modules/stanford_person_importer/src/Cap.php

Summary

Maintainability
A
0 mins
Test Coverage
A
96%

The class Cap has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13.
Wontfix

class Cap implements CapInterface {

  use StringTranslationTrait;

  /**

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

Source https://phpmd.org/rules/design.html#couplingbetweenobjects

Missing class import via use statement (line '156', column '17').
Wontfix

      throw new \Exception($e->getMessage());

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

Avoid assigning values to variables in if clauses and the like (line '299', column '9').
Invalid

  protected function getAccessToken(): ?string {
    if ($cache = $this->cache->get('cap:access_token')) {
      return $cache->data['access_token'];
    }

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

  protected function getOrgData(): array {
    if ($cache = $this->cache->get('cap:org_data')) {
      return $cache->data;
    }

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

Declaration of function setClientSecret(string $secret) : \Drupal\stanford_person_importer\Cap should be compatible with function setClientSecret(string $secret) : \Drupal\stanford_person_importer\CapInterface (method returning '\Drupal\stanford_person_importer\Cap' cannot override method returning '\Drupal\stanford_person_importer\CapInterface') defined in /code/modules/stanford_person_importer/src/CapInterface.php:49
Invalid

  public function setClientSecret(string $secret): self {

Declaration of function setClientId(string $client_id) : \Drupal\stanford_person_importer\Cap should be compatible with function setClientId(string $client_id) : \Drupal\stanford_person_importer\CapInterface (method returning '\Drupal\stanford_person_importer\Cap' cannot override method returning '\Drupal\stanford_person_importer\CapInterface') defined in /code/modules/stanford_person_importer/src/CapInterface.php:38
Invalid

  public function setClientId(string $client_id): self {

Doc comment short description must start with a capital letter
Invalid

   * {@inheritDoc}

Doc comment short description must start with a capital letter
Invalid

   * {@inheritDoc}

Doc comment short description must start with a capital letter
Invalid

   * {@inheritDoc}

Doc comment short description must end with a full stop
Invalid

   * {@inheritDoc}

Doc comment short description must start with a capital letter
Invalid

   * {@inheritDoc}

Doc comment short description must start with a capital letter
Invalid

   * {@inheritDoc}

Doc comment short description must end with a full stop
Invalid

   * {@inheritDoc}

Doc comment short description must end with a full stop
Invalid

   * {@inheritDoc}

Doc comment short description must start with a capital letter
Invalid

   * {@inheritDoc}

Doc comment short description must end with a full stop
Invalid

   * {@inheritDoc}

Doc comment short description must end with a full stop
Invalid

   * {@inheritDoc}

Doc comment short description must start with a capital letter
Invalid

   * {@inheritDoc}

Doc comment short description must end with a full stop
Invalid

   * {@inheritDoc}

Doc comment short description must end with a full stop
Invalid

   * {@inheritDoc}

Doc comment short description must start with a capital letter
Invalid

   * {@inheritDoc}

Doc comment short description must end with a full stop
Invalid

   * {@inheritDoc}

There are no issues that match your filters.

Category
Status