These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Hateoas\Tests\Configuration\Provider\Resolver; |
||
4 | |||
5 | use Hateoas\Configuration\RelationProvider; |
||
6 | use Hateoas\Configuration\Provider\Resolver\MethodResolver; |
||
7 | use Hateoas\Tests\TestCase; |
||
8 | |||
9 | View Code Duplication | class MethodResolverTest extends TestCase |
|
0 ignored issues
–
show
|
|||
10 | { |
||
11 | public function test() |
||
12 | { |
||
13 | $object = new \StdClass(); |
||
14 | $providerProvider = new MethodResolver(); |
||
15 | |||
16 | $this |
||
17 | ->variable($providerProvider->getRelationProvider(new RelationProvider('!-;'), $object)) |
||
18 | ->isNull() |
||
19 | ->variable($providerProvider->getRelationProvider(new RelationProvider('foo:bar'), $object)) |
||
20 | ->isNull() |
||
21 | ->variable($providerProvider->getRelationProvider(new RelationProvider('foo::bar'), $object)) |
||
22 | ->isNull() |
||
23 | ->variable($providerProvider->getRelationProvider(new RelationProvider('getRelations'), $object)) |
||
24 | ->isEqualTo(array($object, 'getRelations')) |
||
25 | ; |
||
26 | } |
||
27 | } |
||
28 |
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.