Jelle-S/TheSportsDb

View on GitHub

Showing 92 of 92 total issues

Avoid unused parameters such as '$value'.
Open

  public static function reverseEventTime($value, Event $context) {
Severity: Minor
Found in src/Entity/Event.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 112 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

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

Avoid assigning values to variables in if clauses and the like (line '99', column '10').
Open

  public function sanitizeProperty(\stdClass &$object, FactoryContainerInterface $factoryContainer) {
    if (($entityType = $this->getEntityType()) && isset($object->{$this->getName()})) {
      $value = &$object->{$this->getName()};
      if ($this->isArray()) {
        foreach ($value as &$val) {

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 using static access to class '\TheSportsDb\Entity\EntityPropertyUtil' in method 'raw'.
Open

          $this->_raw->{$prop} = EntityPropertyUtil::getRawValue($val);
Severity: Minor
Found in src/Entity/Proxy/Proxy.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 initPropertyMapDefinition() has 129 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

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

Avoid unused parameters such as '$context'.
Open

  public static function transformEvents(array $values, $context, EntityManagerInterface $entityManager) {
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

Avoid unused parameters such as '$value'.
Open

  public static function transformEventTime($value) {
Severity: Minor
Found in src/Entity/Event.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 variable $time_parts is not named in camelCase.
Open

  public static function transformDateTime($value, $format, $time = NULL) {
    $date = new \DateTime($value);
    $date->createFromFormat($format, $value);
    if ($time && $time !== EntityManager::EMPTYPROPERTYPLACEHOLDER) {
      $time_parts = explode(':', $time);
Severity: Minor
Found in src/Entity/Entity.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $time_parts is not named in camelCase.
Open

  public static function transformDateTime($value, $format, $time = NULL) {
    $date = new \DateTime($value);
    $date->createFromFormat($format, $value);
    if ($time && $time !== EntityManager::EMPTYPROPERTYPLACEHOLDER) {
      $time_parts = explode(':', $time);
Severity: Minor
Found in src/Entity/Entity.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $time_parts is not named in camelCase.
Open

  public static function transformDateTime($value, $format, $time = NULL) {
    $date = new \DateTime($value);
    $date->createFromFormat($format, $value);
    if ($time && $time !== EntityManager::EMPTYPROPERTYPLACEHOLDER) {
      $time_parts = explode(':', $time);
Severity: Minor
Found in src/Entity/Entity.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $time_parts is not named in camelCase.
Open

  public static function transformDateTime($value, $format, $time = NULL) {
    $date = new \DateTime($value);
    $date->createFromFormat($format, $value);
    if ($time && $time !== EntityManager::EMPTYPROPERTYPLACEHOLDER) {
      $time_parts = explode(':', $time);
Severity: Minor
Found in src/Entity/Entity.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $time_parts is not named in camelCase.
Open

  public static function transformDateTime($value, $format, $time = NULL) {
    $date = new \DateTime($value);
    $date->createFromFormat($format, $value);
    if ($time && $time !== EntityManager::EMPTYPROPERTYPLACEHOLDER) {
      $time_parts = explode(':', $time);
Severity: Minor
Found in src/Entity/Entity.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

Severity
Category
Status
Source
Language