Conditions | 5 |
Paths | 9 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 5.675 |
Changes | 0 |
1 | <?php |
||
28 | 14 | public function setUpClearable(array $options) |
|
29 | { |
||
30 | 14 | $config = []; |
|
31 | 14 | foreach ($options as $key => $value) { |
|
32 | 14 | if (strpos($key, "cleanup.") === 0) { |
|
33 | 14 | $config[str_replace('cleanup.', '', $key)] = $value; |
|
34 | } |
||
35 | } |
||
36 | |||
37 | 14 | if (isset($config['type'])) { |
|
38 | $skip = isset($config['skipOnFailure']) ? (bool) $config['skipOnFailure'] : true; |
||
39 | // creating cleanup config |
||
40 | $this->cleanupConfig = new Cleanup($config['type'], $skip, $config); |
||
41 | // creating cleaner |
||
42 | $this->cleaner = (new Factory())->createCleaner($this->cleanupConfig->type, $this->cleanupConfig->options); |
||
43 | } |
||
44 | 14 | } |
|
45 | |||
56 | } |