also looking at this
Video Functionalities
#69
4 files
+190
-32
| @@ -0,0 +1,46 @@ | ||
| 1 | <?php | |
| 2 | ||
| 3 | namespace Meema\MeemaClient\Traits; | |
| 4 | ||
| 5 | use GuzzleHttp\Psr7\Utils; | |
| 6 | ||
| 7 | trait UrlResponse | |
| 8 | { | |
| 9 | /** | |
| 10 | * Convert all parameters to string url. | |
| 11 | * | |
| 12 | * @return string | |
| 13 | */ | |
| 14 | public function toUrl() | |
| 15 | { | |
| 16 | $queryParams = ''; | |
| 17 | ||
| 18 | $index = 0; | |
| 19 | ||
| 20 | foreach ($this->args as $key => $param) { | |
| 21 | $separator = '?'; | |
| 22 | ||
| 23 | if ($index) { | |
| 24 | $separator = '&'; | |
| 25 | } | |
| 26 | ||
| 27 | $queryParams .= "{$separator}{$key}={$param}"; | |
| 28 | ||
| 29 | $index++; | |
| 30 | } | |
| 31 | ||
| 32 | return "https://dev-ops.mee.ma/glenn/1/5/people.jpg{$queryParams}"; | |
| 33 | } | |
| 34 | ||
| 35 | /** | |
| 36 | * Convert all parameters to string url. | |
| 37 | * | |
| 38 | * @return string | |
| 39 | */ | |
| 40 | public function toBuffer() | |
| 41 | { | |
| 42 | $path = $this->toUrl(); | |
| 43 | ||
| 44 | return Utils::streamFor($path); | |
| 45 | } | |
| 46 | } | |