Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
48 | 2 | public function writeHash($currentHash, $hash) |
|
49 | { |
||
50 | 2 | $content = $this->writer->getCurrentConfig(); |
|
51 | 2 | $content = preg_replace( |
|
52 | 2 | "/([\'\"]hash[\'\"].+?[\'\"])(" . preg_quote($currentHash, '/') . ")([\'\"].*)/", |
|
53 | 2 | "'hash' => '" . $hash . "',", |
|
54 | 2 | $content, |
|
55 | 2 | 1, |
|
56 | 2 | $count |
|
57 | ); |
||
58 | 2 | if ($count != 1) { |
|
59 | 1 | throw new \RuntimeException("Could not find current hash key in config."); |
|
60 | } |
||
61 | |||
62 | 1 | $this->writer->setCurrentConfig($content); |
|
63 | 1 | return $hash; |
|
64 | } |
||
65 | } |
||
66 |