Conditions | 2 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 8 |
Lines | 18 |
Ratio | 100 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
39 | 2 | View Code Duplication | public function handle(string $planIdentifier) |
1 ignored issue
–
show
|
|||
40 | { |
||
41 | 2 | $link = $this->baseUrl . str_replace(":identifier", $planIdentifier, self::FETCH_PLAN_LINK); |
|
42 | |||
43 | /** |
||
44 | * @var ResponseInterface $response |
||
45 | */ |
||
46 | 2 | $response = $this->adapter->getHttpClient() |
|
47 | 2 | ->get($link); |
|
48 | |||
49 | 2 | if (200 !== $response->getStatusCode()) { |
|
50 | 1 | throw new InvalidHttpResponseException( |
|
51 | 1 | "Expected 200. Got {$response->getStatusCode()} instead" |
|
52 | ); |
||
53 | } |
||
54 | |||
55 | 1 | return json_decode($response->getBody(), true)['data']; |
|
56 | } |
||
57 | } |
||
58 |
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.