Skip to content

Commit

Permalink
add abstraction layer into redis client (#6)
Browse files Browse the repository at this point in the history
constraint scrutinizer to php 7.2

update composer package
  • Loading branch information
veelasky authored and palicao committed Dec 19, 2019
1 parent 3862ad9 commit 365c6fb
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/RedisClient.php → src/Client/RedisClient.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
declare(strict_types=1);

namespace Palicao\PhpRedisTimeSeries;
namespace Palicao\PhpRedisTimeSeries\Client;

use Palicao\PhpRedisTimeSeries\Exception\RedisClientException;
use Redis;
use RedisException;

class RedisClient
class RedisClient implements RedisClientInterface
{
/** @var Redis */
private $redis;
Expand Down
9 changes: 9 additions & 0 deletions src/Client/RedisClientInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
declare(strict_types=1);

namespace Palicao\PhpRedisTimeSeries\Client;

interface RedisClientInterface
{
function executeCommand(array $params);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
declare(strict_types=1);

namespace Palicao\PhpRedisTimeSeries;
namespace Palicao\PhpRedisTimeSeries\Client;

class RedisConnectionParams
{
Expand Down
7 changes: 4 additions & 3 deletions src/TimeSeries.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@
namespace Palicao\PhpRedisTimeSeries;

use DateTimeInterface;
use Palicao\PhpRedisTimeSeries\Client\RedisClientInterface;
use Palicao\PhpRedisTimeSeries\Exception\RedisClientException;
use RedisException;

class TimeSeries
{
/** @var RedisClient */
/** @var RedisClientInterface */
private $redis;

/**
* @param RedisClient $redis
* @param RedisClientInterface $redis
*/
public function __construct(RedisClient $redis)
public function __construct(RedisClientInterface $redis)
{
$this->redis = $redis;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
use Palicao\PhpRedisTimeSeries\DateTimeUtils;
use Palicao\PhpRedisTimeSeries\Filter;
use Palicao\PhpRedisTimeSeries\Label;
use Palicao\PhpRedisTimeSeries\RedisClient;
use Palicao\PhpRedisTimeSeries\RedisConnectionParams;
use Palicao\PhpRedisTimeSeries\Client\RedisClient;
use Palicao\PhpRedisTimeSeries\Client\RedisConnectionParams;
use Palicao\PhpRedisTimeSeries\Sample;
use Palicao\PhpRedisTimeSeries\TimeSeries;
use PHPUnit\Framework\TestCase;
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/RedisClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace Palicao\PhpRedisTimeSeries\Tests\Unit;

use Palicao\PhpRedisTimeSeries\Exception\RedisClientException;
use Palicao\PhpRedisTimeSeries\RedisClient;
use Palicao\PhpRedisTimeSeries\RedisConnectionParams;
use Palicao\PhpRedisTimeSeries\Client\RedisClient;
use Palicao\PhpRedisTimeSeries\Client\RedisConnectionParams;
use PHPUnit\Framework\Constraint\IsType;
use PHPUnit\Framework\TestCase;
use Redis;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/TimeSeriesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Palicao\PhpRedisTimeSeries\Filter;
use Palicao\PhpRedisTimeSeries\Label;
use Palicao\PhpRedisTimeSeries\Metadata;
use Palicao\PhpRedisTimeSeries\RedisClient;
use Palicao\PhpRedisTimeSeries\Client\RedisClient;
use Palicao\PhpRedisTimeSeries\Sample;
use Palicao\PhpRedisTimeSeries\TimeSeries;
use PHPUnit\Framework\MockObject\MockObject;
Expand Down

0 comments on commit 365c6fb

Please sign in to comment.