| Total Complexity | 3 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class Api |
||
| 12 | { |
||
| 13 | public const URL = 'https://api.fondbot.io'; |
||
| 14 | |||
| 15 | private $client; |
||
| 16 | |||
| 17 | public function __construct(Client $client) |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Get all available drivers. |
||
| 24 | * |
||
| 25 | * @return Collection |
||
| 26 | */ |
||
| 27 | public function getDrivers(): Collection |
||
| 28 | { |
||
| 29 | $response = $this->client->get(self::URL.'/drivers', ['json' => ['version' => FondBot::VERSION]]); |
||
| 30 | |||
| 31 | return collect(json_decode((string) $response->getBody(), true)); |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Find driver by name. |
||
| 36 | * |
||
| 37 | * @param string $name |
||
| 38 | * |
||
| 39 | * @return array|null |
||
| 40 | */ |
||
| 41 | public function findDriver(string $name): ?array |
||
| 45 | }); |
||
| 46 | } |
||
| 48 |