Total Complexity | 5 |
Total Lines | 62 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
14 | class CacheOptions |
||
15 | { |
||
16 | /** |
||
17 | * @var null|bool |
||
18 | */ |
||
19 | public $noCache; |
||
20 | |||
21 | /** |
||
22 | * @var Args |
||
23 | */ |
||
24 | private $args; |
||
25 | |||
26 | /** |
||
27 | * @param Args $args |
||
28 | * |
||
29 | * @return CacheOptions |
||
30 | */ |
||
31 | 2 | public static function bind(Args $args) |
|
32 | { |
||
33 | 2 | return new self($args); |
|
34 | } |
||
35 | |||
36 | /** |
||
37 | * @param Args $args |
||
38 | */ |
||
39 | 2 | public function __construct(Args $args) |
|
40 | { |
||
41 | 2 | $this->args = $args; |
|
42 | 2 | } |
|
43 | |||
44 | /** |
||
45 | * @return CacheOptions |
||
46 | */ |
||
47 | 2 | public function run() |
|
48 | { |
||
49 | 2 | list($this->noCache) = $this->parse($this->args); |
|
50 | |||
51 | 2 | return $this; |
|
52 | } |
||
53 | |||
54 | /** |
||
55 | * Parse --no-cache argument |
||
56 | * |
||
57 | * @param Args $args |
||
58 | * |
||
59 | * @throws \InvalidArgumentException |
||
60 | * |
||
61 | * @return array |
||
62 | */ |
||
63 | 2 | public function parse(Args $args) |
|
64 | { |
||
65 | 2 | $noCache = $args->hasOption('no-cache'); |
|
66 | |||
67 | 2 | return array($noCache); |
|
68 | } |
||
69 | |||
70 | /** |
||
71 | * @return bool |
||
72 | */ |
||
73 | 1 | public function hasCache() |
|
76 | } |
||
77 | } |
||
78 |