| @@ 29-44 (lines=16) @@ | ||
| 26 | * @param string $value |
|
| 27 | * @return array |
|
| 28 | */ |
|
| 29 | public function get($value) |
|
| 30 | { |
|
| 31 | if (strlen($value) < 1) { |
|
| 32 | return $this->failedResponse("Search keyword cannot be empty"); |
|
| 33 | } |
|
| 34 | ||
| 35 | try { |
|
| 36 | $response = $this->search(new Request, $value); |
|
| 37 | return [ |
|
| 38 | 'status' => true, |
|
| 39 | 'data' => $this->vendor->build($response) |
|
| 40 | ]; |
|
| 41 | } catch (Exception $except) { |
|
| 42 | return $this->failedResponse($except->getMessage()); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * @param Request $request |
|
| @@ 70-84 (lines=15) @@ | ||
| 67 | * @param string $feedUrl |
|
| 68 | * @return array |
|
| 69 | */ |
|
| 70 | public function find($feedUrl) |
|
| 71 | { |
|
| 72 | if (strlen($feedUrl) < 1) { |
|
| 73 | return $this->failedResponse("Feed Url cannot be empty"); |
|
| 74 | } |
|
| 75 | ||
| 76 | try { |
|
| 77 | return [ |
|
| 78 | 'status' => true, |
|
| 79 | 'data' => $this->vendor->buildFeed($this->getFeedFromUrl($feedUrl)) |
|
| 80 | ]; |
|
| 81 | } catch (Exception $except) { |
|
| 82 | return $this->failedResponse($except->getMessage()); |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||
| 86 | /** |
|
| 87 | * @param int $limit |
|