BaseDriver   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 24
c 0
b 0
f 0
ccs 9
cts 9
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getMax() 0 14 4
1
<?php
2
/**
3
 * AnimeDb package.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2014, Peter Gribanov
7
 * @license   http://opensource.org/licenses/MIT
8
 */
9
10
namespace AnimeDb\Bundle\CacheTimeKeeperBundle\Service\Driver;
11
12
abstract class BaseDriver implements DriverInterface
13
{
14
    /**
15
     * Get a list of keys or dates and chooses the max date.
16
     *
17
     * @param array $params
18
     *
19
     * @return \DateTime
20
     */
21 8
    public function getMax(array $params)
22
    {
23 8
        if (empty($params)) {
24 4
            throw new \InvalidArgumentException('Unknown key list');
25
        }
26
27 4
        foreach ($params as $key => $value) {
28 4
            if (!($value instanceof \DateTime)) {
29 4
                $params[$key] = $this->get($value);
30 4
            }
31 4
        }
32
33 4
        return max($params);
34
    }
35
}
36