Conditions | 5 |
Paths | 9 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 5.675 |
Changes | 0 |
1 | <?php |
||
40 | 16 | public function setUpClearable(array $options) |
|
41 | { |
||
42 | 16 | $config = []; |
|
43 | 16 | foreach ($options as $key => $value) { |
|
44 | 16 | if (strpos($key, "cleanup.") === 0) { |
|
45 | 16 | $config[str_replace('cleanup.', '', $key)] = $value; |
|
46 | } |
||
47 | } |
||
48 | |||
49 | 16 | if (isset($config['type'])) { |
|
50 | $skip = isset($config['skipOnFailure']) ? (bool) $config['skipOnFailure'] : true; |
||
51 | // creating cleanup config |
||
52 | $this->cleanupConfig = new Cleanup($config['type'], $skip, $config); |
||
53 | // creating cleaner |
||
54 | $this->cleaner = (new Factory())->createCleaner($this->cleanupConfig->type, $this->cleanupConfig->options); |
||
55 | } |
||
56 | 16 | } |
|
57 | |||
68 | } |