Skip to content

Commit

Permalink
Merge pull request #2 from A5sys/namespace-change
Browse files Browse the repository at this point in the history
change namespace
  • Loading branch information
arnaudgoulpeau authored Dec 1, 2016
2 parents c85bbc3 + 580a178 commit 2495607
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 34 deletions.
2 changes: 1 addition & 1 deletion CookedMeasure/Coordinate.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace QowisioCloudApiBundle\CookedMeasure;
namespace A5sys\QowisioCloudApiBundle\CookedMeasure;

/**
* Represents a GPS coordinate, with latitude and longitude
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace QowisioCloudApiBundle\DependencyInjection;
namespace A5sys\QowisioCloudApiBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/QowisioCloudApiExtension.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace QowisioCloudApiBundle\DependencyInjection;
namespace A5sys\QowisioCloudApiBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
Expand Down
2 changes: 1 addition & 1 deletion Exception/QowisioCredentialsException.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace QowisioCloudApiBundle\Exception;
namespace A5sys\QowisioCloudApiBundle\Exception;

/**
* When credentials are wrong
Expand Down
2 changes: 1 addition & 1 deletion Exception/QowisioException.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace QowisioCloudApiBundle\Exception;
namespace A5sys\QowisioCloudApiBundle\Exception;

/**
* When an error occurs into the bundle
Expand Down
2 changes: 1 addition & 1 deletion QowisioCloudApiBundle.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace QowisioCloudApiBundle;
namespace A5sys\QowisioCloudApiBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

Expand Down
10 changes: 5 additions & 5 deletions Resources/config/services.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
parameters:
# Service to call Qowisio WS
qowisio.cloud.api.caller.class: 'QowisioCloudApiBundle\Service\QowisioApiCaller'
qowisio.cloud.api.caller.class: 'A5sys\QowisioCloudApiBundle\Service\QowisioApiCaller'
# Service to get auth infos
qowisio.cloud.api.authentication.class: 'QowisioCloudApiBundle\Service\QowisioApiAuthenticationService'
qowisio.cloud.api.authentication.class: 'A5sys\QowisioCloudApiBundle\Service\QowisioApiAuthenticationService'
# Service to get devices and sensors data
qowisio.cloud.api.devices.and.sensors.class: 'QowisioCloudApiBundle\Service\QowisioApiDevicesAndSensorsService'
qowisio.cloud.api.devices.and.sensors.class: 'A5sys\QowisioCloudApiBundle\Service\QowisioApiDevicesAndSensorsService'
# Service to get measures data
qowisio.cloud.api.measures.class: 'QowisioCloudApiBundle\Service\QowisioApiMeasuresService'
qowisio.cloud.api.measures.class: 'A5sys\QowisioCloudApiBundle\Service\QowisioApiMeasuresService'
# Service to get data from a GPS device (named tracker)
qowisio.tracker.class: 'QowisioCloudApiBundle\Service\QowisioTrackerService'
qowisio.tracker.class: 'A5sys\QowisioCloudApiBundle\Service\QowisioTrackerService'

services:
# makes the calls to API
Expand Down
6 changes: 3 additions & 3 deletions Service/QowisioApiAuthenticationService.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace QowisioCloudApiBundle\Service;
namespace A5sys\QowisioCloudApiBundle\Service;

use QowisioCloudApiBundle\Exception\QowisioException;
use A5sys\QowisioCloudApiBundle\Exception\QowisioException;

/**
* Test if your user is authenticated
Expand All @@ -21,7 +21,7 @@ class QowisioApiAuthenticationService

/**
* Constructor
* @param \QowisioCloudApiBundle\Service\QowisioApiCaller $apiCaller
* @param \A5sys\QowisioCloudApiBundle\Service\QowisioApiCaller $apiCaller
*/
public function __construct(QowisioApiCaller $apiCaller)
{
Expand Down
6 changes: 3 additions & 3 deletions Service/QowisioApiCaller.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php

namespace QowisioCloudApiBundle\Service;
namespace A5sys\QowisioCloudApiBundle\Service;

use Eljam\GuzzleJwt\JwtMiddleware;
use Eljam\GuzzleJwt\Manager\JwtManager;
use Eljam\GuzzleJwt\Strategy\Auth\JsonAuthStrategy;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\HandlerStack;
use QowisioCloudApiBundle\Exception\QowisioCredentialsException;
use QowisioCloudApiBundle\Exception\QowisioException;
use A5sys\QowisioCloudApiBundle\Exception\QowisioCredentialsException;
use A5sys\QowisioCloudApiBundle\Exception\QowisioException;

/**
* service to call Web Services against Qowisio Cloud API
Expand Down
4 changes: 2 additions & 2 deletions Service/QowisioApiDevicesAndSensorsService.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace QowisioCloudApiBundle\Service;
namespace A5sys\QowisioCloudApiBundle\Service;

/**
* Access description of your objects and sensors
Expand All @@ -20,7 +20,7 @@ class QowisioApiDevicesAndSensorsService

/**
* Constructor
* @param \QowisioCloudApiBundle\Service\QowisioApiCaller $apiCaller
* @param \A5sys\QowisioCloudApiBundle\Service\QowisioApiCaller $apiCaller
*/
public function __construct(QowisioApiCaller $apiCaller)
{
Expand Down
10 changes: 5 additions & 5 deletions Service/QowisioApiMeasuresService.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace QowisioCloudApiBundle\Service;
namespace A5sys\QowisioCloudApiBundle\Service;

/**
* Access description of your objects and sensors
Expand All @@ -18,7 +18,7 @@ class QowisioApiMeasuresService

/**
* Constructor
* @param \QowisioCloudApiBundle\Service\QowisioApiCaller $apiCaller
* @param \A5sys\QowisioCloudApiBundle\Service\QowisioApiCaller $apiCaller
*/
public function __construct(QowisioApiCaller $apiCaller)
{
Expand All @@ -44,9 +44,9 @@ public function getLastMeasures($sensorUid, $limit = 100)
/**
* Return a maximum of 100 measures from present to past.<br>
* You can add 'from_date' and 'to_date' filters to request data on a specific range and 'limit', to limit the number of results.<br>
* @param string $sensorUid
* @param \DateTime $from Date when search starts
* @param \DateTime $to Date when search stop
* @param string $sensorUid
* @param \DateTime $from Date when search starts
* @param \DateTime $to Date when search stop
* @param integer $limit
* @return array
*/
Expand Down
23 changes: 13 additions & 10 deletions Service/QowisioTrackerService.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace QowisioCloudApiBundle\Service;
namespace A5sys\QowisioCloudApiBundle\Service;

use QowisioCloudApiBundle\CookedMeasure\Coordinate;
use A5sys\QowisioCloudApiBundle\CookedMeasure\Coordinate;

/**
* service to get data from a GPS device (named tracker)
Expand All @@ -24,7 +24,7 @@ class QowisioTrackerService

/**
* Constructor
* @param \QowisioCloudApiBundle\Service\QowisioApiMeasuresService $measuresService
* @param \A5sys\QowisioCloudApiBundle\Service\QowisioApiMeasuresService $measuresService
*/
public function __construct(QowisioApiMeasuresService $measuresService)
{
Expand All @@ -34,7 +34,8 @@ public function __construct(QowisioApiMeasuresService $measuresService)
/**
* Get the 100 last GPS coordinates from the device
* @param string $deviceUid the UID of the device
* @param string $sort optionnal default QowisioTrackerService::SORT_DESC. one of QowisioTrackerService::SORT_DESC or QowisioTrackerService::SORT_ASC
* @param string $sort optionnal default QowisioTrackerService::SORT_DESC. one of QowisioTrackerService::SORT_DESC or QowisioTrackerService::SORT_ASC
* @return array<Coordinate>
*/
public function getLastCoordinates($deviceUid, $sort = self::SORT_DESC)
{
Expand All @@ -46,11 +47,12 @@ public function getLastCoordinates($deviceUid, $sort = self::SORT_DESC)

/**
* Get the GPS coordinates from the device
* @param string $deviceUid the UID of the device
* @param \DateTime $from Date when search starts
* @param \DateTime $to Date when search stop
* @param integer $limit optionnal default 100
* @param string $sort optionnal default QowisioTrackerService::SORT_DESC. one of QowisioTrackerService::SORT_DESC or QowisioTrackerService::SORT_ASC
* @param string $deviceUid The UID of the device
* @param \DateTime $from Date when search starts
* @param \DateTime $to Date when search stop
* @param integer $limit optionnal default 100
* @param string $sort optionnal default QowisioTrackerService::SORT_DESC. one of QowisioTrackerService::SORT_DESC or QowisioTrackerService::SORT_ASC
* @return array<Coordinate>
*/
public function getCoordinates($deviceUid, \DateTime $from, \DateTime $to, $limit = 100, $sort = self::SORT_DESC)
{
Expand Down Expand Up @@ -80,10 +82,11 @@ protected function getGpsCoordinates($latitudeList, $longitudeList, $sort)
}

if ($sort === static::SORT_ASC) {
$ascending = function($coordA, $coordB) {
$ascending = function ($coordA, $coordB) {
if ($coordA->getTimestampCollected() === $coordB->getTimestampCollected()) {
return 0;
}

return $coordA->getTimestampCollected() < $coordB->getTimestampCollected() ? -1 : 1;
};
usort($coordinates, $ascending);
Expand Down

0 comments on commit 2495607

Please sign in to comment.