Skip to content

Commit ae9f981

Browse files
committed
2 parents 952720d + e858a03 commit ae9f981

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

src/Handlers/AbstractHandler.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ protected function validate()
4141

4242
private function validateFile(): bool
4343
{
44-
if (!is_file($this->file)) {
44+
if (! is_file($this->file)) {
4545
return false;
4646
}
4747

4848
if (filesize($this->file) == 0) {
4949
return false;
5050
}
5151

52-
if (!is_writable($this->file)) {
52+
if (! is_writable($this->file)) {
5353
return false;
5454
}
5555

@@ -59,7 +59,7 @@ private function validateFile(): bool
5959
private function validateDirectory(): bool
6060
{
6161
if (is_dir($this->dir_to_archive)) {
62-
if (!is_writable($this->dir_to_archive)) {
62+
if (! is_writable($this->dir_to_archive)) {
6363
event(new RotateHasFailed($this->file, new Exception('Directory '.$this->dir_to_archive.' to archive logs is not writable')));
6464

6565
return false;
@@ -74,7 +74,7 @@ private function validateDirectory(): bool
7474
return false;
7575
}
7676

77-
if (!mkdir($this->dir_to_archive, 0777, true)) {
77+
if (! mkdir($this->dir_to_archive, 0777, true)) {
7878
event(new RotateHasFailed($this->file, new Exception('Directory '.$this->dir_to_archive.' to archive logs is not writable')));
7979

8080
return false;
@@ -101,19 +101,19 @@ protected function moveData($fileSource, $fileDestination)
101101
return false;
102102
}
103103

104-
if (!flock($fdSource, LOCK_EX)) {
104+
if (! flock($fdSource, LOCK_EX)) {
105105
fclose($fdSource);
106106

107107
return false;
108108
}
109109

110-
if (!copy($fileSource, $fileDestination)) {
110+
if (! copy($fileSource, $fileDestination)) {
111111
fclose($fdSource);
112112

113113
return false;
114114
}
115115

116-
if (!ftruncate($fdSource, 0)) {
116+
if (! ftruncate($fdSource, 0)) {
117117
fclose($fdSource);
118118

119119
unlink($fileDestination);

src/Handlers/RotativeHandler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct($file, $max_files = 0, bool $compress = true, $dir_t
2020

2121
public function run()
2222
{
23-
if (!$this->validate()) {
23+
if (! $this->validate()) {
2424
return false;
2525
}
2626

@@ -53,7 +53,7 @@ protected function rotate()
5353
if ($fd_tmp !== false) {
5454
$fd_compress = gzopen($this->file_rotated, 'w');
5555

56-
while (!feof($fd_tmp)) {
56+
while (! feof($fd_tmp)) {
5757
gzwrite($fd_compress, fread($fd_tmp, 1024 * 512));
5858
}
5959

@@ -75,7 +75,7 @@ protected function getRotatedFileName()
7575

7676
$curFiles = glob($patternGlob);
7777

78-
for ($n = count($curFiles); $n > 0; --$n) {
78+
for ($n = count($curFiles); $n > 0; $n--) {
7979
$file_to_move = str_replace('*', $n, $patternGlob);
8080

8181
if (file_exists($file_to_move)) {
@@ -94,7 +94,7 @@ private function getPatternGlob($fileInfo): string
9494
{
9595
$patternGlob = $fileInfo['dirname'].'/'.$fileInfo['filename'];
9696

97-
if (!empty($fileInfo['extension'])) {
97+
if (! empty($fileInfo['extension'])) {
9898
$patternGlob .= '.'.$fileInfo['extension'];
9999
}
100100

src/Helpers/Log.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static function getLaravelLogFiles()
1818
$files = [];
1919

2020
foreach (self::getHandlers() as $handler) {
21-
if ($handler instanceof StreamHandler && !$handler instanceof RotatingFileHandler) {
21+
if ($handler instanceof StreamHandler && ! $handler instanceof RotatingFileHandler) {
2222
$files[] = $handler->getUrl();
2323
}
2424
}
@@ -29,7 +29,7 @@ public static function getLaravelLogFiles()
2929
public static function closeHandlers()
3030
{
3131
foreach (self::getHandlers() as $handler) {
32-
if ($handler instanceof StreamHandler && !$handler instanceof RotatingFileHandler) {
32+
if ($handler instanceof StreamHandler && ! $handler instanceof RotatingFileHandler) {
3333
if (method_exists($handler, 'close')) {
3434
$handler->close();
3535
}

src/RotateServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function register()
4242

4343
private function registerSchedule()
4444
{
45-
if (!config('rotate.schedule.enable', true)) {
45+
if (! config('rotate.schedule.enable', true)) {
4646
return;
4747
}
4848

tests/Handlers/RotativeHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function testItCanRotateLogsWithMaxfiles()
5454

5555
$this->app['config']->set('rotate.log_compress_files', true);
5656

57-
for ($n = 0; $n < 10; ++$n) {
57+
for ($n = 0; $n < 10; $n++) {
5858
$this->writeLog();
5959

6060
$this->assertGreaterThan(0, filesize(app()->storagePath().'/logs/laravel.log'));

tests/ScheduleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function testHasSchedule()
1313

1414
private function scheduleRegistered(): bool
1515
{
16-
return !is_null($this->schedule());
16+
return ! is_null($this->schedule());
1717
}
1818

1919
private function schedule()

tests/TestCase.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function setUp(): void
2626

2727
$this->cleanLogs();
2828

29-
if (!file_exists($this->tmpDir)) {
29+
if (! file_exists($this->tmpDir)) {
3030
mkdir($this->tmpDir);
3131
}
3232
}
@@ -49,7 +49,7 @@ protected function cleanLogs()
4949
$filesToRemove = glob(dirname($fileLog).'/*');
5050

5151
foreach ($filesToRemove as $f) {
52-
if (is_file($f) && !is_dir($f)) {
52+
if (is_file($f) && ! is_dir($f)) {
5353
unlink($f);
5454
}
5555
}
@@ -58,15 +58,15 @@ protected function cleanLogs()
5858
$filesToRemove = glob($this->tmpDir.'/*');
5959

6060
foreach ($filesToRemove as $f) {
61-
if (is_file($f) && !is_dir($f)) {
61+
if (is_file($f) && ! is_dir($f)) {
6262
unlink($f);
6363
}
6464
}
6565

6666
$filesToRemove = glob($this->tmpDir.'/archive/*');
6767

6868
foreach ($filesToRemove as $f) {
69-
if (is_file($f) && !is_dir($f)) {
69+
if (is_file($f) && ! is_dir($f)) {
7070
unlink($f);
7171
}
7272
}

0 commit comments

Comments
 (0)