Completed
Push — master ( 1fe4a5...c184ef )
by Samuel
01:45
created

AppGlobalId   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getIdFromGlobalId() 0 10 2
1
<?php
2
3
namespace App\Common\App\Transformer;
4
5
use Overblog\GraphQLBundle\Relay\Node\GlobalId;
6
7
class AppGlobalId extends GlobalId
8
{
9
    /**
10
     * @param $globalId
11
     * @return int|null
12
     */
13
    public static function getIdFromGlobalId(?string $globalId): ?string
14
    {
15
        $decodedGlobalId = parent::fromGlobalId($globalId);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (fromGlobalId() instead of getIdFromGlobalId()). Are you sure this is correct? If so, you might want to change this to $this->fromGlobalId().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
16
17
        if (!$decodedGlobalId['id']) {
18
            return null;
19
        }
20
21
        return $decodedGlobalId['id'];
22
    }
23
}