ReviewOS

also looking at this

ci-on/laravel-log-reader

Apply fixes from StyleCI

#4
Merged simoebenhida wants to merge analysis-zR9Rb7 into master
5 files +20 -20
src/Reader/LogReader.phpmodified+12-11
Changes to src/Reader/LogReader.php
@@ -1,12 +1,13 @@
11<?php
2declare(strict_types = 1);
2
3declare(strict_types=1);
34
45namespace Cion\LaravelLogReader\Reader;
56
6use Cion\LaravelLogReader\Reader\Exception\FolderNotFoundException;
7use Illuminate\Filesystem\Filesystem;
87use Illuminate\Support\Collection;
8use Illuminate\Filesystem\Filesystem;
99use Symfony\Component\Finder\SplFileInfo;
10use Cion\LaravelLogReader\Reader\Exception\FolderNotFoundException;
1011
1112class LogReader
1213{
@@ -23,7 +24,7 @@ class LogReader
2324 $this->filesystem = new Filesystem;
2425 }
2526
26 public function read() : LogReader
27 public function read() : self
2728 {
2829 $this->setTime();
2930
@@ -75,7 +76,7 @@ class LogReader
7576 });
7677 }
7778
78 public function getSubDirectoriesFiles() : LogReader
79 public function getSubDirectoriesFiles() : self
7980 {
8081 collect($this->filesystem->directories($this->getPath()))->map(function ($directory) {
8182 collect($this->filesystem->files($directory))->filter(function ($file) {
@@ -86,7 +87,7 @@ class LogReader
8687 return $this;
8788 }
8889
89 public function getDiretoryFiles() : LogReader
90 public function getDiretoryFiles() : self
9091 {
9192 collect($this->filesystem->files($this->getPath()))->filter(function ($file) {
9293 $this->files[] = $file;
renamed throughout · 24 hidden lines
Changes to src/Reader/LogReader.php
@@ -114,21 +115,21 @@ class LogReader renamed throughout
114115 }
115116 }
116117
117 public function all() : LogReader
118 public function all() : self
118119 {
119120 $this->time = null;
120121
121122 return $this;
122123 }
123124
124 public function today() : LogReader
125 public function today() : self
125126 {
126127 $this->time = now();
127128
128129 return $this;
129130 }
130131
131 public function yesterday() : LogReader
132 public function yesterday() : self
132133 {
133134 $this->time = now()->yesterday();
134135
Changes to src/Reader/LogReader.php
@@ -162,7 +163,7 @@ class LogReader
162163 if ((new LineHelper($line))->hasDate()) {
163164 $sections->push([
164165 'line' => $line,
165 'extra' => []
166 'extra' => [],
166167 ]);
167168 } else {
168169 $sections = $this->addToLastSection($sections, $line);
@@ -174,7 +175,7 @@ class LogReader
174175
175176 public function addToLastSection(Collection $sections, string $line)
176177 {
177 $size = sizeof($sections);
178 $size = count($sections);
178179
179180 return $sections->map(function ($value, $key) use ($size, $line) {
180181 if ($size - 1 === $key) {
src/Reader/LogSectionReader.phpmodified+4-3
Changes to src/Reader/LogSectionReader.php
@@ -1,5 +1,6 @@
11<?php
2declare(strict_types = 1);
2
3declare(strict_types=1);
34
45namespace Cion\LaravelLogReader\Reader;
56
@@ -35,7 +36,7 @@ class LogSectionReader
3536 $this->extra = collect($section['extra']);
3637 }
3738
38 public function read() : LogSectionReader
39 public function read() : self
3940 {
4041 $this->retrieveSectionInformations();
4142
@@ -100,7 +101,7 @@ class LogSectionReader
100101 'date' => $this->date,
101102 'type' => $this->type,
102103 'message' => $this->message,
103 'extra' => $this->extra->toArray()
104 'extra' => $this->extra->toArray(),
104105 ];
105106 }
106107}
src/config.phpmodified+1-1
Changes to src/config.php
@@ -7,5 +7,5 @@ return [
77
88 'env' => env('APP_ENV'),
99
10 'middleware' => 'auth'
10 'middleware' => 'auth',
1111];
src/routes.phpmodified+0-2
Changes to src/routes.php
@@ -1,7 +1,5 @@
11<?php
22
3use Cion\LaravelLogReader\Reader\LogReader;
4
53Route::group(['prefix' => config('logreader.prefix', 'logreader'), 'middleware' => config('logreader.middleware', 'auth')], function () {
64 Route::get('/', 'Cion\LaravelLogReader\Reader\LogReaderController@index');
75});
tests/LogReaderSectionTest.phpmodified+3-3
Changes to tests/LogReaderSectionTest.php
@@ -1,13 +1,13 @@
11<?php
2
23namespace Cion\LaravelLogReader\Tests;
34
4use Cion\LaravelLogReader\Reader\LogSectionReader;
5use Cion\LaravelLogReader\Reader\LogReader;
65use Illuminate\Filesystem\Filesystem;
6use Cion\LaravelLogReader\Reader\LogReader;
77
88class LogReaderSectionTest extends TestCase
99{
10 const PATH = __DIR__.'/log/laravel.log' ;
10 const PATH = __DIR__.'/log/laravel.log';
1111
1212 protected $filesystem;
1313