| Conditions | 5 |
| Paths | 5 |
| Total Lines | 25 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 2 | ||
| 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 ommit 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_put_contents($historyFile, $history); |
||
| 48 | } |
||
| 49 | } |
||
| 50 |