also looking at this
Apply fixes from StyleCI
#4
5 files
+20
-20
| @@ -1,12 +1,13 @@ | ||
| 1 | 1 | <?php |
| 2 | declare(strict_types = 1); | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 3 | 4 | |
| 4 | 5 | namespace Cion\LaravelLogReader\Reader; |
| 5 | 6 | |
| 6 | use Cion\LaravelLogReader\Reader\Exception\FolderNotFoundException; | |
| 7 | use Illuminate\Filesystem\Filesystem; | |
| 8 | 7 | use Illuminate\Support\Collection; |
| 8 | use Illuminate\Filesystem\Filesystem; | |
| 9 | 9 | use Symfony\Component\Finder\SplFileInfo; |
| 10 | use Cion\LaravelLogReader\Reader\Exception\FolderNotFoundException; | |
| 10 | 11 | |
| 11 | 12 | class LogReader |
| 12 | 13 | { |
| @@ -23,7 +24,7 @@ class LogReader | ||
| 23 | 24 | $this->filesystem = new Filesystem; |
| 24 | 25 | } |
| 25 | 26 | |
| 26 | public function read() : LogReader | |
| 27 | public function read() : self | |
| 27 | 28 | { |
| 28 | 29 | $this->setTime(); |
| 29 | 30 | |
| @@ -75,7 +76,7 @@ class LogReader | ||
| 75 | 76 | }); |
| 76 | 77 | } |
| 77 | 78 | |
| 78 | public function getSubDirectoriesFiles() : LogReader | |
| 79 | public function getSubDirectoriesFiles() : self | |
| 79 | 80 | { |
| 80 | 81 | collect($this->filesystem->directories($this->getPath()))->map(function ($directory) { |
| 81 | 82 | collect($this->filesystem->files($directory))->filter(function ($file) { |
| @@ -86,7 +87,7 @@ class LogReader | ||
| 86 | 87 | return $this; |
| 87 | 88 | } |
| 88 | 89 | |
| 89 | public function getDiretoryFiles() : LogReader | |
| 90 | public function getDiretoryFiles() : self | |
| 90 | 91 | { |
| 91 | 92 | collect($this->filesystem->files($this->getPath()))->filter(function ($file) { |
| 92 | 93 | $this->files[] = $file; |
renamed throughout · 24 hidden lines
| @@ -114,21 +115,21 @@ class LogReader renamed throughout | ||
| 114 | 115 | } |
| 115 | 116 | } |
| 116 | 117 | |
| 117 | public function all() : LogReader | |
| 118 | public function all() : self | |
| 118 | 119 | { |
| 119 | 120 | $this->time = null; |
| 120 | 121 | |
| 121 | 122 | return $this; |
| 122 | 123 | } |
| 123 | 124 | |
| 124 | public function today() : LogReader | |
| 125 | public function today() : self | |
| 125 | 126 | { |
| 126 | 127 | $this->time = now(); |
| 127 | 128 | |
| 128 | 129 | return $this; |
| 129 | 130 | } |
| 130 | 131 | |
| 131 | public function yesterday() : LogReader | |
| 132 | public function yesterday() : self | |
| 132 | 133 | { |
| 133 | 134 | $this->time = now()->yesterday(); |
| 134 | 135 | |
| @@ -162,7 +163,7 @@ class LogReader | ||
| 162 | 163 | if ((new LineHelper($line))->hasDate()) { |
| 163 | 164 | $sections->push([ |
| 164 | 165 | 'line' => $line, |
| 165 | 'extra' => [] | |
| 166 | 'extra' => [], | |
| 166 | 167 | ]); |
| 167 | 168 | } else { |
| 168 | 169 | $sections = $this->addToLastSection($sections, $line); |
| @@ -174,7 +175,7 @@ class LogReader | ||
| 174 | 175 | |
| 175 | 176 | public function addToLastSection(Collection $sections, string $line) |
| 176 | 177 | { |
| 177 | $size = sizeof($sections); | |
| 178 | $size = count($sections); | |
| 178 | 179 | |
| 179 | 180 | return $sections->map(function ($value, $key) use ($size, $line) { |
| 180 | 181 | if ($size - 1 === $key) { |