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