Skip to content

Commit 4059fca

Browse files
szepeviktormheap
andcommitted
Implement logic in fewer lines (#2)
Co-authored-by: Michael Heap <m@michaelheap.com>
1 parent eae9402 commit 4059fca

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/Printer.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ protected function printDefects(array $defects, string $type): void
2626
{
2727
$this->currentType = $type;
2828

29-
$i=0;
30-
foreach ($defects as $defect) {
31-
$this->printDefect($defect, $i++);
29+
foreach ($defects as $i => $defect) {
30+
$this->printDefect($defect, $i);
3231
}
3332
}
3433

@@ -57,19 +56,15 @@ function($l){ return $l; }
5756
}
5857

5958
protected function getCurrentType() {
60-
if (in_array($this->currentType, ['error', 'failure'])) {
61-
return 'error';
62-
}
63-
64-
return 'warning';
59+
return in_array($this->currentType, ['error', 'failure']) ? 'error' : 'warning';
6560
}
6661

6762
protected function relativePath(string $path) {
68-
return str_replace(getcwd().'/', "", $path);
63+
return str_replace(getcwd().'/', '', $path);
6964
}
7065

7166
protected function getReflectionFromTest(string $name) {
72-
list($klass, $method) = explode("::", $name);
67+
list($klass, $method) = explode('::', $name);
7368
$c = new \ReflectionClass($klass);
7469
$m = $c->getMethod($method);
7570

0 commit comments

Comments
 (0)