/** * {@inheritdoc} */ public function getBeaconPositions($username, $pin, \DateTime $start = null, \DateTime $end = null, $limit = null) { $params = ['username' => $username, 'pin' => $pin]; if ($start) { $params['date_from'] = $start->format('Y-m-d H:i:s'); } if ($end) { $params['date_until'] = $end->format('Y-m-d H:i:s'); } if ($limit) { $params['limit'] = $limit; } $command = $this->getCommand('getBBPositions', $params); $responseModel = $this->execute($command); $this->validateResponse($responseModel); $response = $responseModel->toArray(); $locations = new ArrayCollection([]); foreach ($response['VIEWRANGER']['LOCATIONS'] as $location) { $beacon = Beacon::fromArray($location); $locations->set($beacon->getDateTime()->format('U'), $beacon); } return $locations; }
public function testItShouldReturnTheSpeed() { $this->assertEquals(5, $this->beacon->getSpeed()); }