| 1 | <?php |
||
| 8 | class Pug |
||
| 9 | { |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @var ClientInterface |
||
| 13 | */ |
||
| 14 | private $client; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * baseUrl to the pugme api |
||
| 18 | * |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | private $baseUrl = "http://pugme.herokuapp.com/"; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * |
||
| 25 | * @param ClientInterface $client |
||
| 26 | */ |
||
| 27 | 4 | public function __construct(ClientInterface $client) |
|
| 31 | |||
| 32 | /** |
||
| 33 | * send a request to pugme api |
||
| 34 | * |
||
| 35 | * @param string $url |
||
| 36 | * @return mixed |
||
| 37 | * @throws PugNotFoundException |
||
| 38 | */ |
||
| 39 | 3 | private function sendRequest($url) |
|
| 49 | |||
| 50 | /** |
||
| 51 | * Gets a link to a pug |
||
| 52 | * |
||
| 53 | * @return string |
||
| 54 | */ |
||
| 55 | 1 | public function random() |
|
| 59 | |||
| 60 | /** |
||
| 61 | * |
||
| 62 | * Gets a link to a pug |
||
| 63 | * |
||
| 64 | * @return string |
||
| 65 | * @throws PugNotFoundException |
||
| 66 | */ |
||
| 67 | 2 | public function get() |
|
| 72 | |||
| 73 | |||
| 74 | /** |
||
| 75 | * Get multiple links to pugs |
||
| 76 | * |
||
| 77 | * @param int $count |
||
| 78 | * @return string |
||
| 79 | * @throws PugNotFoundException |
||
| 80 | */ |
||
| 81 | 1 | public function bomb($count=5) |
|
| 86 | } |
||
| 87 |