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

ItemBatch   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 44
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
A getItemKey() 0 4 1
A getItemDate() 0 4 1
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
}