GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( de2245...dcc1f2 )
by Baptiste
05:00 queued 02:53
created

NamedMethodStrategy::supports()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 7
CRAP Score 2
Metric Value
dl 11
loc 11
ccs 7
cts 7
cp 1
rs 9.4285
cc 2
eloc 7
nc 2
nop 2
crap 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Reflection\ExtractionStrategy;
5
6
use Innmind\Reflection\ExtractionStrategyInterface;
7
use Innmind\Reflection\Exception\LogicException;
8
use Innmind\Immutable\StringPrimitive;
9
10 View Code Duplication
class NamedMethodStrategy implements ExtractionStrategyInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15 5
    public function supports($object, string $property): bool
16
    {
17 5
        $refl = new \ReflectionObject($object);
18
19 5
        $property = (string) (new StringPrimitive($property))
0 ignored issues
show
Bug introduced by
The method camelize() does not seem to exist on object<Innmind\Immutable\StringPrimitive>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
20 5
            ->camelize()
21 5
            ->lcfirst();
22
23 5
        return $refl->hasMethod($property) &&
24 5
            $refl->getMethod($property)->getNumberOfRequiredParameters() === 0;
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30 3
    public function extract($object, string $property)
31
    {
32 3
        if (!$this->supports($object, $property)) {
33 1
            throw new LogicException;
34
        }
35
36 2
        $property = (string) (new StringPrimitive($property))
0 ignored issues
show
Bug introduced by
The method camelize() does not seem to exist on object<Innmind\Immutable\StringPrimitive>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
37 2
            ->camelize()
38 2
            ->lcfirst();
39
40 2
        return $object->$property();
41
    }
42
}
43