Skip to content

Commit dcfacaf

Browse files
committed
Merge pull request #4 from Nyholm/patch-3
Added more constructor arguments
2 parents 19d0fc5 + 44c1742 commit dcfacaf

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/CacheItem.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class CacheItem implements HasExpirationDateInterface, CacheItemInterface, Tagga
3434
private $value;
3535

3636
/**
37-
* @type \DateTime|null
37+
* @type \DateTimeInterface|null
3838
*/
3939
private $expirationDate = null;
4040

@@ -44,12 +44,21 @@ class CacheItem implements HasExpirationDateInterface, CacheItemInterface, Tagga
4444
private $hasValue = false;
4545

4646
/**
47-
* @param string $key
47+
* @param string $key
48+
* @param bool $hasValue
49+
* @param mixed $value
50+
* @param \DateTimeInterface|null $experationDate
4851
*/
49-
public function __construct($key)
52+
public function __construct($key, $hasValue = false, $value = null, \DateTimeInterface $experationDate = null)
5053
{
51-
$this->taggedKey = $key;
52-
$this->key = $this->getKeyFromTaggedKey($key);
54+
$this->taggedKey = $key;
55+
$this->key = $this->getKeyFromTaggedKey($key);
56+
$this->hasValue = $hasValue;
57+
$this->experationDate = $experationDate;
58+
59+
if ($hasValue) {
60+
$this->value = $value;
61+
}
5362
}
5463

5564
/**

0 commit comments

Comments
 (0)