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 WyriHaximus\Travis; |
||
4 | |||
5 | use ArrayIterator; |
||
6 | use IteratorAggregate; |
||
7 | use Psr\Http\Message\RequestInterface; |
||
8 | use Psr\Http\Message\ResponseInterface; |
||
9 | use Traversable; |
||
10 | |||
11 | View Code Duplication | class BuildCollection implements EndpointInterface, IteratorAggregate |
|
0 ignored issues
–
show
|
|||
12 | { |
||
13 | use ParentHasClientAwareTrait; |
||
14 | |||
15 | /** |
||
16 | * @var Repository |
||
17 | */ |
||
18 | protected $repository; |
||
19 | |||
20 | /** |
||
21 | * @var array |
||
22 | */ |
||
23 | protected $builds; |
||
24 | |||
25 | public function __construct(Repository $repository, array $builds) |
||
26 | { |
||
27 | $this->setParent($repository); |
||
28 | $this->repository = $repository; |
||
29 | $this->builds = $builds; |
||
30 | } |
||
31 | |||
32 | public function getRequest(): RequestInterface |
||
33 | { |
||
34 | // TODO: Implement getRequest() method. |
||
35 | } |
||
36 | |||
37 | public function fromResponse(ResponseInterface $response): EndpointInterface |
||
38 | { |
||
39 | // TODO: Implement fromResponse() method. |
||
40 | } |
||
41 | |||
42 | public function getIterator() |
||
43 | { |
||
44 | return new ArrayIterator($this->builds); |
||
45 | } |
||
46 | } |
||
47 |
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.