Skip to content

Commit 1bf3893

Browse files
committed
style
1 parent d59e4c1 commit 1bf3893

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

src/MongoDBCachePool.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,22 @@
1313

1414
use Cache\Adapter\Common\AbstractCachePool;
1515
use Cache\Adapter\Common\CacheItem;
16-
use MongoDB\Driver\Exception\BulkWriteException;
17-
use Psr\Cache\CacheItemInterface;
16+
use MongoDB\BSON\UTCDateTime;
1817
use MongoDB\Collection;
1918
use MongoDB\Driver\Manager;
20-
use MongoDB\BSON\UTCDateTime;
19+
use Psr\Cache\CacheItemInterface;
2120

2221
/**
2322
* @author Tobias Nyholm <[email protected]>
2423
*/
2524
class MongoDBCachePool extends AbstractCachePool
2625
{
2726
/**
28-
* @var Collection
27+
* @type Collection
2928
*/
3029
private $collection;
3130

3231
/**
33-
*
3432
* @param Collection $collection
3533
*/
3634
public function __construct(Collection $collection)
@@ -54,7 +52,6 @@ protected function fetchObjectFromCache($key)
5452
$item = new CacheItem($key, true, unserialize($object->data));
5553

5654
if (isset($object->expiresAt)) {
57-
5855
$item->expiresAt($object->expiresAt->toDateTime());
5956
}
6057

@@ -81,7 +78,7 @@ protected function clearOneObjectFromCache($key)
8178
protected function storeItemInCache($key, CacheItemInterface $item, $ttl)
8279
{
8380
$object = [
84-
'_id' => $key,
81+
'_id' => $key,
8582
'data' => serialize($item->get()),
8683
];
8784

tests/CreateServerTrait.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of php-cache\mongodb-adapter package.
5+
*
6+
* (c) 2015-2015 Aaron Scherer <[email protected]>, Tobias Nyholm <[email protected]>
7+
*
8+
* This source file is subject to the MIT license that is bundled
9+
* with this source code in the file LICENSE.
10+
*/
11+
312
namespace Cache\Adapter\MongoDB\Tests;
413

514
use Cache\Adapter\MongoDB\MongoDBCachePool;
@@ -15,12 +24,12 @@ trait CreateServerTrait
1524
public function getCollection()
1625
{
1726
if ($this->collection === null) {
18-
$manager = new Manager("mongodb://".getenv('MONGODB_HOST'));
27+
$manager = new Manager('mongodb://'.getenv('MONGODB_HOST'));
1928

2029
// In your own code, only do this *once* to initialize your cache
2130
$this->collection = MongoDBCachePool::createCollection($manager, getenv('MONGODB_COLLECTION'));
2231
}
2332

2433
return $this->collection;
2534
}
26-
}
35+
}

tests/IntegrationTagTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Cache\Adapter\MongoDB\MongoDBCachePool;
1515
use Cache\IntegrationTests\TaggableCachePoolTest;
16-
use MongoDB\Driver\Manager;
1716

1817
class IntegrationTagTest extends TaggableCachePoolTest
1918
{

0 commit comments

Comments
 (0)