Total Complexity | 5 |
Total Lines | 25 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
18 | class Response implements Responsable |
||
19 | { |
||
20 | /** @var \Cog\Laravel\Sense\Url\Models\Url */ |
||
21 | private $url; |
||
22 | |||
23 | public function __construct($url) |
||
24 | { |
||
25 | $this->url = $url; |
||
26 | } |
||
27 | |||
28 | public function toResponse($request) |
||
29 | { |
||
30 | return $request->wantsJson() ? $this->toJson() : $this->toHtml(); |
||
|
|||
31 | } |
||
32 | |||
33 | private function toHtml() |
||
34 | { |
||
35 | return view('sense::urls.view', [ |
||
36 | 'url' => $this->url, |
||
37 | ]); |
||
38 | } |
||
39 | |||
40 | private function toJson() |
||
43 | } |
||
44 | } |
||
45 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: