public function testAsync() { $params = new CarRouteParams(); $params->addWaypoint('82.838287 54.96579')->addWaypoint([82.83828699999999, 54.97979]); $requests = new AsyncParams(); for ($x = 0; $x < 1; $x++) { $requests->addRequest('transport/calculate_directions', $params); } /** @var $data GisResponse[] */ $data = Api2Gis::call()->getAsync($requests->getRequests()); $this->assertGreaterThan(0, $data[0]->getCount()); $this->assertGreaterThan(0, count($data[0]->getItems())); }
/** * Выполнение ассинхронных подготовленных запросов * @return Types\GisResponse[] */ public function execute() { $result = $this->getAsync($this->asyncRequests->getRequests()); $this->asyncRequests->clearRequests(); return $result; }