Jelle-S/TheSportsDb

View on GitHub

Showing 92 of 92 total issues

Missing class import via use statement (line '35', column '17').
Open

      throw new \Exception('Entity manager already set.');

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

Missing class import via use statement (line '27', column '15').
Open

    throw new \Exception('Could not fully load league with id ' . $this->properties->id . '.');
Severity: Minor
Found in src/Entity/Proxy/LeagueProxy.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

Missing class import via use statement (line '44', column '23').
Open

    $this->_raw = new \stdClass();
Severity: Minor
Found in src/Entity/Entity.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

Missing class import via use statement (line '79', column '23').
Open

    $reflection = new \ReflectionClass(static::class);
Severity: Minor
Found in src/Entity/Entity.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

Missing class import via use statement (line '91', column '17').
Open

      throw new \Exception('Factory container already set.');
Severity: Minor
Found in src/Entity/EntityManager.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

Missing class import via use statement (line '101', column '17').
Open

      throw new \Exception('Repository container already set.');
Severity: Minor
Found in src/Entity/EntityManager.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

Missing class import via use statement (line '132', column '25').
Open

      $realClass = (new \ReflectionClass(static::class))->getNamespaceName() . '\\' . ucfirst($entityType);
Severity: Minor
Found in src/Entity/EntityManager.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

Missing class import via use statement (line '141', column '17').
Open

      throw new \Exception('Class ' . $proxyClass . 'not found.');
Severity: Minor
Found in src/Entity/EntityManager.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

Missing class import via use statement (line '53', column '13').
Open

        new \ReflectionClass($this->entityManager->getClass($entityType, 'proxy'))
Severity: Minor
Found in src/Entity/Factory/Factory.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

Missing class import via use statement (line '50', column '15').
Open

    throw new \Exception('Could not fully load league with id ' . $this->properties->id . '.');
Severity: Minor
Found in src/Entity/Proxy/LeagueProxy.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

Function loadSeasons has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  protected function loadSeasons() {
    $leagueData = $this->sportsDbClient->doRequest('lookupleague.php', array('id' => $this->properties->id, 's' => 'all'));
    if (isset($leagueData->leagues)) {
      $leagues = $leagueData->leagues;
      foreach ($leagues as &$league) {
Severity: Minor
Found in src/Entity/Proxy/LeagueProxy.php - About 25 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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  public function update(\stdClass $values) {
    if ($this->entity instanceof EntityInterface) {
      $this->entity->update($values);
      return;
    }
Severity: Minor
Found in src/Entity/Proxy/Proxy.php - About 25 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

The method initPropertyMapDefinition() has 197 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

  protected static function initPropertyMapDefinition() {
    static::$propertyMapDefinition
      ->addPropertyMap(
        new PropertyDefinition('idEvent'),
        new PropertyDefinition('id')
Severity: Minor
Found in src/Entity/Event.php by phpmd

Avoid unused parameters such as '$context'.
Open

  public static function reverseId($value, $context) {
Severity: Minor
Found in src/Entity/Season.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

The method initPropertyMapDefinition() has 102 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

  protected static function initPropertyMapDefinition() {
    static::$propertyMapDefinition
      ->addPropertyMap(
        new PropertyDefinition('idLeague'),
        new PropertyDefinition('id')
Severity: Minor
Found in src/Entity/League.php by phpmd

Avoid unused parameters such as '$context'.
Open

  public static function reverse($entity, $context, EntityManagerInterface $entityManager) {
Severity: Minor
Found in src/Entity/Entity.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

Avoid unused parameters such as '$entityManager'.
Open

  public static function reverse($entity, $context, EntityManagerInterface $entityManager) {
Severity: Minor
Found in src/Entity/Entity.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

Avoid unused parameters such as '$context'.
Open

  public static function transformSeasons($values, $context, EntityManagerInterface $entityManager) {
Severity: Minor
Found in src/Entity/League.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

Avoid unused parameters such as '$context'.
Open

  public static function transformLeagues($values, $context, EntityManagerInterface $entityManager) {
Severity: Minor
Found in src/Entity/Sport.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

Avoid using static access to class '\TheSportsDb\Entity\EntityPropertyUtil' in method 'raw'.
Open

          $this->_raw->{$prop} = EntityPropertyUtil::getRawValue($val);
Severity: Minor
Found in src/Entity/Entity.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

Severity
Category
Status
Source
Language