Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

RoutesDataAccess.php 999B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: robin
  5. * Date: 9/30/16
  6. * Time: 8:57 PM
  7. */
  8. namespace App\DataAccess;
  9. use App\Dbo\RoutesDbo;
  10. use GuzzleHttp\Client;
  11. use Luticate\Utils\Controller\LuticateApplication;
  12. class RoutesDataAccess
  13. {
  14. public static function getAll(string $resourceId, string $type)
  15. {
  16. $client = new Client();
  17. $entrypoint = LuticateApplication::getInstance()->getSetting("API_ENTRYPOINT");
  18. $response = $client->request("GET", $entrypoint . "transit/${resourceId}/${type}/routes.json");
  19. $data = json_decode($response->getBody(), true);
  20. /**
  21. * @var $dbos RoutesDbo[]
  22. */
  23. $dbos = [];
  24. foreach ($data["data"] as $route) {
  25. $dbo = new RoutesDbo();
  26. $dbo->setId($route["id"]);
  27. $dbo->setName($route["name"]);
  28. $dbo->setBgColor($route["color"]);
  29. $dbo->setFgColor($route["text_color"]);
  30. $dbos[] = $dbo;
  31. }
  32. return $dbos;
  33. }
  34. }