Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 16 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
19 | View Code Duplication | public function query() |
|
1 ignored issue
–
show
|
|||
20 | { |
||
21 | $url = '/segments'; |
||
22 | |||
23 | // Now make the request. |
||
24 | $request = new Request('GET', $url); |
||
25 | $data = $this->client->getResponseJson($request); |
||
26 | |||
27 | // Get them as Segment objects |
||
28 | $segments = []; |
||
29 | foreach ($data as $dataItem) { |
||
30 | $segments[] = new Segment($dataItem); |
||
31 | } |
||
32 | |||
33 | return $segments; |
||
34 | } |
||
35 | } |
||
36 |
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.