| Conditions | 5 |
| Paths | 7 |
| Total Lines | 23 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 5 |
| Changes | 3 | ||
| Bugs | 0 | Features | 3 |
| 1 | <?php |
||
| 13 | 1 | function run(Runner $runner) |
|
|
|
|||
| 14 | {
|
||
| 15 | 1 | $jobs = $runner->listJobs(); |
|
| 16 | |||
| 17 | 1 | $info = []; |
|
| 18 | 1 | foreach($jobs as $nick => $class) {
|
|
| 19 | // get comment |
||
| 20 | 1 | $reflection = new ReflectionClass($class); |
|
| 21 | 1 | $comments = []; |
|
| 22 | 1 | foreach(explode(PHP_EOL, $reflection->getDocComment()) as $line) {
|
|
| 23 | 1 | if(!in_array(substr($line, 0, 3), ['/**', ' */'])) {
|
|
| 24 | 1 | $comments[] = trim(substr($line, 2)); |
|
| 25 | } |
||
| 26 | } |
||
| 27 | 1 | $comment = implode(PHP_EOL, $comments); |
|
| 28 | 1 | if(!$comment) {
|
|
| 29 | 1 | $comment = '-'; |
|
| 30 | } |
||
| 31 | 1 | $info[] = compact('nick', 'class', 'comment');
|
|
| 32 | } |
||
| 33 | |||
| 34 | 1 | return compact('info');
|
|
| 35 | } |
||
| 36 | } |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.