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 — develop ( fb2cf2...a0a09f )
by Baptiste
02:11
created

InjectionStrategy/SetterStrategy.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Reflection\InjectionStrategy;
5
6
use Innmind\Reflection\InjectionStrategyInterface;
7
use Innmind\Reflection\Exception\LogicException;
8
use Innmind\Immutable\StringPrimitive;
9
10
class SetterStrategy implements InjectionStrategyInterface
11
{
12
    private $setter;
13
14 4
    public function __construct()
15
    {
16 4
        $this->setter = new StringPrimitive('set%s');
17 4
    }
18
19
    /**
20
     * {@inheritdoc}
21
     */
22 8
    public function supports($object, string $property, $value): bool
23
    {
24 8
        $refl = new \ReflectionObject($object);
25
26 8
        return $refl->hasMethod(
27 8
            (string) $this->setter->sprintf(ucfirst($property))
28
        );
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 4 View Code Duplication
    public function inject($object, string $property, $value)
0 ignored issues
show
This method 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...
35
    {
36 4
        if (!$this->supports($object, $property, $value)) {
37 1
            throw new LogicException;
38
        }
39
40 3
        $setter = (string) $this->setter->sprintf(ucfirst($property));
41 3
        $object->$setter($value);
42 3
    }
43
}
44