Completed
Push — V6 ( 6bfaa5...2f3d58 )
by Georges
03:19
created

ItemBatch::getItemKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 *
4
 * This file is part of phpFastCache.
5
 *
6
 * @license MIT License (MIT)
7
 *
8
 * For full copyright and license information, please see the docs/CREDITS.txt file.
9
 *
10
 * @author Khoa Bui (khoaofgod)  <[email protected]> http://www.phpfastcache.com
11
 * @author Georges.L (Geolim4)  <[email protected]>
12
 *
13
 */
14
namespace phpFastCache\Entities;
15
16
use phpFastCache\Exceptions\phpFastCacheInvalidArgumentException;
17
18
/**
19
 * Class ItemBatch
20
 * @package phpFastCache\Entities
21
 */
22
class ItemBatch
23
{
24
    /**
25
     * @var string
26
     */
27
    protected $itemKey;
28
29
    /**
30
     * @var \DateTime
31
     */
32
    protected $itemDate;
33
34
    /**
35
     * ItemBatch constructor.
36
     * @param $itemKey
37
     * @param \DateTime $itemDate
38
     * @throws \phpFastCache\Exceptions\phpFastCacheInvalidArgumentException
39
     */
40
    public function __construct($itemKey, \DateTime $itemDate)
41
    {
42
        if(is_string($itemKey)){
43
            $this->itemKey = $itemKey;
44
            $this->itemDate = $itemDate;
45
        }else{
46
            throw new phpFastCacheInvalidArgumentException(sprintf('$itemKey must be a string, got "%s" instead', gettype($itemKey)));
47
        }
48
    }
49
50
    /**
51
     * @return string
52
     */
53
    public function getItemKey()
54
    {
55
        return $this->itemKey;
56
    }
57
58
    /**
59
     * @return \DateTime
60
     */
61
    public function getItemDate()
62
    {
63
        return $this->itemDate;
64
    }
65
}