Skip to content

Commit

Permalink
added php 5.6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolay Poluhin committed May 22, 2024
1 parent c0bbe10 commit 32b057c
Show file tree
Hide file tree
Showing 73 changed files with 424 additions and 629 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ phpunit.xml.dist text eol=lf export-ignore
.gitignore text eol=lf export-ignore
.gitattributes text eol=lf export-ignore
.phpcs.xml text eol=lf export-ignore
phpstan.neon text eol=lf export-ignore
.yamllint text eol=lf export-ignore
34 changes: 0 additions & 34 deletions .github/workflows/phpcs.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/phpstan.yml

This file was deleted.

15 changes: 2 additions & 13 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,7 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest]
php-version: ['7.2', '8.3']
include:
- php-version: 7.3
operating-system: ubuntu-latest
- php-version: 7.4
operating-system: ubuntu-latest
- php-version: 8.0
operating-system: ubuntu-latest
- php-version: 8.1
operating-system: ubuntu-latest
- php-version: 8.2
operating-system: ubuntu-latest
php-version: ['7.1']
steps:
- uses: actions/checkout@v2
- name: Install PHP
Expand All @@ -59,7 +48,7 @@ jobs:
strategy:
matrix:
operating-system: [macOS-latest]
php-version: [ '7.2', '8.3' ]
php-version: [ '7.1' ]
steps:
- uses: actions/checkout@v2
- name: Install PHP
Expand Down
12 changes: 5 additions & 7 deletions Cache/CacheInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
*/

declare(strict_types=1);

namespace DeviceDetector\Cache;

interface CacheInterface
Expand All @@ -19,14 +17,14 @@ interface CacheInterface
*
* @return mixed
*/
public function fetch(string $id);
public function fetch($id);

/**
* @param string $id
*
* @return bool
*/
public function contains(string $id): bool;
public function contains($id);

/**
* @param string $id
Expand All @@ -35,17 +33,17 @@ public function contains(string $id): bool;
*
* @return bool
*/
public function save(string $id, $data, int $lifeTime = 0): bool;
public function save($id, $data, $lifeTime = 0);

/**
* @param string $id
*
* @return bool
*/
public function delete(string $id): bool;
public function delete($id);

/**
* @return bool
*/
public function flushAll(): bool;
public function flushAll();
}
12 changes: 5 additions & 7 deletions Cache/DoctrineBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
*/

declare(strict_types=1);

namespace DeviceDetector\Cache;

use Doctrine\Common\Cache\CacheProvider;
Expand All @@ -32,39 +30,39 @@ public function __construct(CacheProvider $cache)
/**
* @inheritDoc
*/
public function fetch(string $id)
public function fetch($id)
{
return $this->cache->fetch($id);
}

/**
* @inheritDoc
*/
public function contains(string $id): bool
public function contains($id)
{
return $this->cache->contains($id);
}

/**
* @inheritDoc
*/
public function save(string $id, $data, int $lifeTime = 0): bool
public function save($id, $data, $lifeTime = 0)
{
return $this->cache->save($id, $data, $lifeTime);
}

/**
* @inheritDoc
*/
public function delete(string $id): bool
public function delete($id)
{
return $this->cache->delete($id);
}

/**
* @inheritDoc
*/
public function flushAll(): bool
public function flushAll()
{
return $this->cache->flushAll();
}
Expand Down
12 changes: 5 additions & 7 deletions Cache/LaravelCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
*/

declare(strict_types=1);

namespace DeviceDetector\Cache;

use Illuminate\Support\Facades\Cache;
Expand All @@ -19,39 +17,39 @@ class LaravelCache implements CacheInterface
/**
* @inheritDoc
*/
public function fetch(string $id)
public function fetch($id)
{
return Cache::get($id);
}

/**
* @inheritDoc
*/
public function contains(string $id): bool
public function contains($id)
{
return Cache::has($id);
}

/**
* @inheritDoc
*/
public function save(string $id, $data, int $lifeTime = 0): bool
public function save($id, $data, $lifeTime = 0)
{
return Cache::put($id, $data, \func_num_args() < 3 ? null : $lifeTime);
}

/**
* @inheritDoc
*/
public function delete(string $id): bool
public function delete($id)
{
return Cache::forget($id);
}

/**
* @inheritDoc
*/
public function flushAll(): bool
public function flushAll()
{
return Cache::flush();
}
Expand Down
12 changes: 5 additions & 7 deletions Cache/PSR16Bridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
*/

declare(strict_types=1);

namespace DeviceDetector\Cache;

use Psr\SimpleCache\CacheInterface as PsrCacheInterface;
Expand All @@ -33,39 +31,39 @@ public function __construct(PsrCacheInterface $cache)
/**
* @inheritDoc
*/
public function fetch(string $id)
public function fetch($id)
{
return $this->cache->get($id, false);
}

/**
* @inheritDoc
*/
public function contains(string $id): bool
public function contains($id)
{
return $this->cache->has($id);
}

/**
* @inheritDoc
*/
public function save(string $id, $data, int $lifeTime = 0): bool
public function save($id, $data, $lifeTime = 0)
{
return $this->cache->set($id, $data, \func_num_args() < 3 ? null : $lifeTime);
}

/**
* @inheritDoc
*/
public function delete(string $id): bool
public function delete($id)
{
return $this->cache->delete($id);
}

/**
* @inheritDoc
*/
public function flushAll(): bool
public function flushAll()
{
return $this->cache->clear();
}
Expand Down
12 changes: 5 additions & 7 deletions Cache/PSR6Bridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
*/

declare(strict_types=1);

namespace DeviceDetector\Cache;

use Psr\Cache\CacheItemPoolInterface;
Expand All @@ -33,7 +31,7 @@ public function __construct(CacheItemPoolInterface $pool)
/**
* @inheritDoc
*/
public function fetch(string $id)
public function fetch($id)
{
$item = $this->pool->getItem($id);

Expand All @@ -43,15 +41,15 @@ public function fetch(string $id)
/**
* @inheritDoc
*/
public function contains(string $id): bool
public function contains($id)
{
return $this->pool->hasItem($id);
}

/**
* @inheritDoc
*/
public function save(string $id, $data, int $lifeTime = 0): bool
public function save($id, $data, $lifeTime = 0)
{
$item = $this->pool->getItem($id);
$item->set($data);
Expand All @@ -66,15 +64,15 @@ public function save(string $id, $data, int $lifeTime = 0): bool
/**
* @inheritDoc
*/
public function delete(string $id): bool
public function delete($id)
{
return $this->pool->deleteItem($id);
}

/**
* @inheritDoc
*/
public function flushAll(): bool
public function flushAll()
{
return $this->pool->clear();
}
Expand Down
Loading

0 comments on commit 32b057c

Please sign in to comment.