Skip to content

Commit 554286f

Browse files
committed
Get the default response for each endpoint
1 parent 88fd808 commit 554286f

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

src/Response.php

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Response
1919
public $store = [];
2020

2121
/**
22-
* Add (or modify) to the response $store
22+
* Add (or modify) items to the response $store
2323
*
2424
* @param string $key
2525
* @param string $value
@@ -54,4 +54,45 @@ public function return(): array
5454
return $this->store;
5555
}
5656

57+
/**
58+
* Returns default response for an endpoint
59+
*
60+
* @param string $endpoint
61+
* @return array $defaults
62+
*/
63+
public function default(string $endpoint): array
64+
{
65+
$response = [];
66+
switch($endpoint)
67+
{
68+
case "film":
69+
$response = [
70+
"id" => "",
71+
"title" => "",
72+
"year" => "",
73+
"length" => "",
74+
"plot" => "",
75+
"rating" => "",
76+
"rating_votes" => "",
77+
"poster" => "",
78+
"trailer" => [
79+
"id" => "",
80+
"link" => ""
81+
],
82+
"cast" => [],
83+
"technical_specs" => []
84+
];
85+
break;
86+
87+
case "search":
88+
$response = [
89+
"titles" => [],
90+
"names" => [],
91+
"companies" => []
92+
];
93+
break;
94+
}
95+
return $response;
96+
}
97+
5798
}

0 commit comments

Comments
 (0)