Conditions | 5 |
Paths | 5 |
Total Lines | 24 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
24 | public function actionIndex() |
||
25 | { |
||
26 | $commitsFile = '.hidev/commits.md'; |
||
27 | $historyFile = Yii::$app->config->historyFile; |
||
28 | |||
29 | if (!file_exists($commitsFile)) { |
||
30 | throw new Exception("no $commitsFile found"); |
||
31 | } |
||
32 | |||
33 | $history = ''; |
||
34 | $commits = file($commitsFile); |
||
35 | foreach ($commits as $line) { |
||
36 | if (preg_match('/^## (\S+) (\S+)$/', $line, $m)) { |
||
37 | $history .= "## [$m[1]] - $m[2]\n"; |
||
38 | |||
39 | // - ebeece6 2016-06-10 commit message ([email protected]) |
||
40 | } elseif (preg_match('/^ - (\S{7}) (\S+) (.*?) \((\S+)\)$/', $line, $m)) { |
||
41 | $history .= " - [$m[1]] $m[2] $m[3] [$m[4]]\n"; |
||
42 | } else { |
||
43 | $history .= $line; |
||
44 | } |
||
45 | } |
||
46 | |||
47 | File::write($historyFile, $history); |
||
48 | } |
||
50 |