diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
index 8f4e42e6..5b8e007b 100644
--- a/.github/workflows/run-tests.yml
+++ b/.github/workflows/run-tests.yml
@@ -9,20 +9,20 @@ jobs:
strategy:
fail-fast: true
matrix:
- php: [7.2, 7.3, 7.4]
+ php: [7.3, 7.4]
dependency-version: [prefer-lowest, prefer-stable]
name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }}
steps:
- name: Checkout code
- uses: actions/checkout@v1
+ uses: actions/checkout@v2
- name: Cache dependencies
- uses: actions/cache@v1
+ uses: actions/cache@v2
with:
path: ~/.composer/cache/files
- key: dependencies-laravel-7.x-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
+ key: dependencies-laravel-8-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
diff --git a/.scrutinizer.yml b/.scrutinizer.yml
index 99369b62..3c0ca63d 100644
--- a/.scrutinizer.yml
+++ b/.scrutinizer.yml
@@ -21,7 +21,7 @@ checks:
tools:
external_code_coverage:
timeout: 600
- runs: 6
+ runs: 4
php_code_sniffer:
enabled: true
config:
diff --git a/README.md b/README.md
index df8a54fc..3839d0d7 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,7 @@ Feel free to check out the [releases](https://github.com/ARCANEDEV/LogViewer/rel
## Features
- A great Log viewer API.
- - Laravel `5.x | 6.x | 7.x` are supported.
+ - Laravel `5.x` to `8.x` are supported.
- Ready to use (Views, Routes, controllers … Out of the box) [Note: No need to publish assets]
- View, paginate, filter, download and delete logs.
- Load a custom logs storage path.
@@ -95,7 +95,7 @@ If you discover any security related issues, please email arcanedev.maroc@gmail.
![Logs list](https://raw.githubusercontent.com/ARCANEDEV/LogViewer/master/_screenshots/2-logs-list.jpg)
![Single log](https://raw.githubusercontent.com/ARCANEDEV/LogViewer/master/_screenshots/3-single-log.jpg)
-[badge_laravel]: https://img.shields.io/badge/Laravel-5.x|6.x|7.x-orange.svg?style=flat-square
+[badge_laravel]: https://img.shields.io/badge/Laravel-5.x%20to%208.x-orange.svg?style=flat-square
[badge_license]: https://img.shields.io/packagist/l/arcanedev/log-viewer.svg?style=flat-square
[badge_build]: https://img.shields.io/github/workflow/status/ARCANEDEV/LogViewer/run-tests?style=flat-square
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/LogViewer.svg?style=flat-square
diff --git a/_docs/0.Home.md b/_docs/0.Home.md
index 87d31b82..8b1f0cec 100644
--- a/_docs/0.Home.md
+++ b/_docs/0.Home.md
@@ -5,7 +5,7 @@ This package allows you to keep track of each one of your logs stored under `sto
## Features
- A great Log viewer API.
- - Laravel `5.x | 6.x | 7.x` are supported.
+ - Laravel `5.x` to `8.x` are supported.
- Ready to use (Views, Routes, controllers … Out of the box) [Note: No need to publish assets]
- View, paginate, filter, download and delete logs.
- Load a custom logs storage path.
diff --git a/_docs/1.Installation-and-Setup.md b/_docs/1.Installation-and-Setup.md
index 29ee545b..4d0e43e4 100644
--- a/_docs/1.Installation-and-Setup.md
+++ b/_docs/1.Installation-and-Setup.md
@@ -21,37 +21,43 @@ Laravel uses the [Monolog PHP logging library](https://github.com/Seldaek/monolo
## Version Compatibility
-| LogViewer | Laravel |
-|:--------------------------------------|:--------------------------------------------------------------------------------------------------------------------|
-| ![LogViewer v4.2.x][log_viewer_4_2_x] | ![Laravel v5.0][laravel_5_0] ![Laravel v5.1][laravel_5_1] ![Laravel v5.2][laravel_5_2] ![Laravel v5.3][laravel_5_3] |
-| ![LogViewer v4.3.x][log_viewer_4_3_x] | ![Laravel v5.4][laravel_5_4] |
-| ![LogViewer v4.4.x][log_viewer_4_4_x] | ![Laravel v5.5][laravel_5_5] |
-| ![LogViewer v4.5.x][log_viewer_4_5_x] | ![Laravel v5.6][laravel_5_6] |
-| ![LogViewer v4.6.x][log_viewer_4_6_x] | ![Laravel v5.7][laravel_5_7] |
-| ![LogViewer v4.7.x][log_viewer_4_7_x] | ![Laravel v5.8][laravel_5_8] |
-| ![LogViewer v5.x][log_viewer_5_x] | ![Laravel v6.x][laravel_6_x] |
-| ![LogViewer v7.x][log_viewer_7_x] | ![Laravel v7.x][laravel_7_x] |
-
-[laravel_5_0]: https://img.shields.io/badge/v5.0-supported-brightgreen.svg?style=flat-square "Laravel v5.0"
-[laravel_5_1]: https://img.shields.io/badge/v5.1-supported-brightgreen.svg?style=flat-square "Laravel v5.1"
-[laravel_5_2]: https://img.shields.io/badge/v5.2-supported-brightgreen.svg?style=flat-square "Laravel v5.2"
-[laravel_5_3]: https://img.shields.io/badge/v5.3-supported-brightgreen.svg?style=flat-square "Laravel v5.3"
-[laravel_5_4]: https://img.shields.io/badge/v5.4-supported-brightgreen.svg?style=flat-square "Laravel v5.4"
-[laravel_5_5]: https://img.shields.io/badge/v5.5-supported-brightgreen.svg?style=flat-square "Laravel v5.5"
-[laravel_5_6]: https://img.shields.io/badge/v5.6-supported-brightgreen.svg?style=flat-square "Laravel v5.6"
-[laravel_5_7]: https://img.shields.io/badge/v5.7-supported-brightgreen.svg?style=flat-square "Laravel v5.7"
-[laravel_5_8]: https://img.shields.io/badge/v5.8-supported-brightgreen.svg?style=flat-square "Laravel v5.8"
-[laravel_6_x]: https://img.shields.io/badge/v6.x-supported-brightgreen.svg?style=flat-square "Laravel v6.x"
-[laravel_7_x]: https://img.shields.io/badge/v7.x-supported-brightgreen.svg?style=flat-square "Laravel v7.x"
-
-[log_viewer_4_2_x]: https://img.shields.io/badge/version-4.2.x-blue.svg?style=flat-square "LogViewer v4.2.x"
-[log_viewer_4_3_x]: https://img.shields.io/badge/version-4.3.x-blue.svg?style=flat-square "LogViewer v4.3.x"
-[log_viewer_4_4_x]: https://img.shields.io/badge/version-4.4.x-blue.svg?style=flat-square "LogViewer v4.4.x"
-[log_viewer_4_5_x]: https://img.shields.io/badge/version-4.5.x-blue.svg?style=flat-square "LogViewer v4.5.x"
-[log_viewer_4_6_x]: https://img.shields.io/badge/version-4.6.x-blue.svg?style=flat-square "LogViewer v4.6.x"
-[log_viewer_4_7_x]: https://img.shields.io/badge/version-4.7.x-blue.svg?style=flat-square "LogViewer v4.7.x"
-[log_viewer_5_x]: https://img.shields.io/badge/version-5.x-blue.svg?style=flat-square "LogViewer v5.x"
+| Laravel | LogViewer |
+|:-----------------------------|:--------------------------------------|
+| ![Laravel v8.x][laravel_8_x] | ![LogViewer v8.x][log_viewer_8_x] |
+| ![Laravel v7.x][laravel_7_x] | ![LogViewer v7.x][log_viewer_7_x] |
+| ![Laravel v6.x][laravel_6_x] | ![LogViewer v5.x][log_viewer_5_x] |
+| ![Laravel v5.8][laravel_5_8] | ![LogViewer v4.7.x][log_viewer_4_7_x] |
+| ![Laravel v5.7][laravel_5_7] | ![LogViewer v4.6.x][log_viewer_4_6_x] |
+| ![Laravel v5.6][laravel_5_6] | ![LogViewer v4.5.x][log_viewer_4_5_x] |
+| ![Laravel v5.5][laravel_5_5] | ![LogViewer v4.4.x][log_viewer_4_4_x] |
+| ![Laravel v5.4][laravel_5_4] | ![LogViewer v4.3.x][log_viewer_4_3_x] |
+| ![Laravel v5.3][laravel_5_3] | ![LogViewer v4.2.x][log_viewer_4_2_x] |
+| ![Laravel v5.2][laravel_5_2] | ![LogViewer v4.2.x][log_viewer_4_2_x] |
+| ![Laravel v5.1][laravel_5_1] | ![LogViewer v4.2.x][log_viewer_4_2_x] |
+| ![Laravel v5.0][laravel_5_0] | ![LogViewer v4.2.x][log_viewer_4_2_x] |
+
+[laravel_8_x]: https://img.shields.io/badge/version-8.x-blue.svg?style=flat-square "Laravel v8.x"
+[laravel_7_x]: https://img.shields.io/badge/version-7.x-blue.svg?style=flat-square "Laravel v7.x"
+[laravel_6_x]: https://img.shields.io/badge/version-6.x-blue.svg?style=flat-square "Laravel v6.x"
+[laravel_5_8]: https://img.shields.io/badge/version-5.8-blue.svg?style=flat-square "Laravel v5.8"
+[laravel_5_7]: https://img.shields.io/badge/version-5.7-blue.svg?style=flat-square "Laravel v5.7"
+[laravel_5_6]: https://img.shields.io/badge/version-5.6-blue.svg?style=flat-square "Laravel v5.6"
+[laravel_5_5]: https://img.shields.io/badge/version-5.5-blue.svg?style=flat-square "Laravel v5.5"
+[laravel_5_4]: https://img.shields.io/badge/version-5.4-blue.svg?style=flat-square "Laravel v5.4"
+[laravel_5_3]: https://img.shields.io/badge/version-5.3-blue.svg?style=flat-square "Laravel v5.3"
+[laravel_5_2]: https://img.shields.io/badge/version-5.2-blue.svg?style=flat-square "Laravel v5.2"
+[laravel_5_1]: https://img.shields.io/badge/version-5.1-blue.svg?style=flat-square "Laravel v5.1"
+[laravel_5_0]: https://img.shields.io/badge/version-5.0-blue.svg?style=flat-square "Laravel v5.0"
+
+[log_viewer_8_x]: https://img.shields.io/badge/version-8.x-blue.svg?style=flat-square "LogViewer v8.x"
[log_viewer_7_x]: https://img.shields.io/badge/version-7.x-blue.svg?style=flat-square "LogViewer v7.x"
+[log_viewer_5_x]: https://img.shields.io/badge/version-5.x-blue.svg?style=flat-square "LogViewer v5.x"
+[log_viewer_4_7_x]: https://img.shields.io/badge/version-4.7.x-blue.svg?style=flat-square "LogViewer v4.7.x"
+[log_viewer_4_6_x]: https://img.shields.io/badge/version-4.6.x-blue.svg?style=flat-square "LogViewer v4.6.x"
+[log_viewer_4_5_x]: https://img.shields.io/badge/version-4.5.x-blue.svg?style=flat-square "LogViewer v4.5.x"
+[log_viewer_4_4_x]: https://img.shields.io/badge/version-4.4.x-blue.svg?style=flat-square "LogViewer v4.4.x"
+[log_viewer_4_3_x]: https://img.shields.io/badge/version-4.3.x-blue.svg?style=flat-square "LogViewer v4.3.x"
+[log_viewer_4_2_x]: https://img.shields.io/badge/version-4.2.x-blue.svg?style=flat-square "LogViewer v4.2.x"
## Composer
diff --git a/composer.json b/composer.json
index 26605d57..88df8dce 100644
--- a/composer.json
+++ b/composer.json
@@ -14,14 +14,14 @@
"type": "library",
"license": "MIT",
"require": {
- "php": "^7.2.5",
- "ext-json": "*",
- "psr/log": "^1.0",
- "arcanedev/support": "^7.0"
+ "php": "^7.3",
+ "ext-json": "*",
+ "arcanedev/support": "^8.0",
+ "psr/log": "^1.1"
},
"require-dev": {
- "orchestra/testbench": "^5.0",
- "phpunit/phpunit": "^8.5"
+ "orchestra/testbench": "^6.0",
+ "phpunit/phpunit": "^9.3"
},
"autoload": {
"psr-4": {
@@ -34,7 +34,14 @@
"Arcanedev\\LogViewer\\Tests\\": "tests/"
}
},
+ "scripts": {
+ "test": "phpunit",
+ "coverage": "phpunit --coverage-html build/coverage/html"
+ },
"extra": {
+ "branch-alias": {
+ "dev-develop": "8.x-dev"
+ },
"laravel": {
"providers": [
"Arcanedev\\LogViewer\\LogViewerServiceProvider",
@@ -42,6 +49,9 @@
]
}
},
+ "config": {
+ "sort-packages": true
+ },
"minimum-stability": "dev",
"prefer-stable": true
}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 6b114f77..031363ca 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,31 +1,25 @@
-
+>
- ./tests/
+ ./tests
-
-
- ./src/
-
-
+
+
+ ./src
+
+
+
+
+
+
+
-
-
-
-
-
diff --git a/src/Commands/CheckCommand.php b/src/Commands/CheckCommand.php
index dc1221a0..2fefac6d 100644
--- a/src/Commands/CheckCommand.php
+++ b/src/Commands/CheckCommand.php
@@ -7,9 +7,8 @@
use Arcanedev\LogViewer\Contracts\Utilities\LogChecker as LogCheckerContract;
/**
- * Class PublishCommand
+ * Class CheckCommand
*
- * @package Arcanedev\LogViewer\Commands
* @author ARCANEDEV
*/
class CheckCommand extends Command
diff --git a/src/Commands/ClearCommand.php b/src/Commands/ClearCommand.php
index d2d275b3..a09382aa 100644
--- a/src/Commands/ClearCommand.php
+++ b/src/Commands/ClearCommand.php
@@ -7,7 +7,6 @@
/**
* Class ClearCommand
*
- * @package Arcanedev\LogViewer\Commands
* @author ARCANEDEV
*/
class ClearCommand extends Command
diff --git a/src/Commands/Command.php b/src/Commands/Command.php
index 3230076e..992d5691 100644
--- a/src/Commands/Command.php
+++ b/src/Commands/Command.php
@@ -10,7 +10,6 @@
/**
* Class Command
*
- * @package Arcanedev\LogViewer\Bases
* @author ARCANEDEV
*/
abstract class Command extends BaseCommand
diff --git a/src/Commands/PublishCommand.php b/src/Commands/PublishCommand.php
index 0e1ed0ba..89082d3e 100644
--- a/src/Commands/PublishCommand.php
+++ b/src/Commands/PublishCommand.php
@@ -10,7 +10,6 @@
/**
* Class PublishCommand
*
- * @package Arcanedev\LogViewer\Commands
* @author ARCANEDEV
*/
class PublishCommand extends Command
diff --git a/src/Commands/StatsCommand.php b/src/Commands/StatsCommand.php
index 78f06f79..cdf77da7 100644
--- a/src/Commands/StatsCommand.php
+++ b/src/Commands/StatsCommand.php
@@ -9,7 +9,6 @@
/**
* Class StatsCommand
*
- * @package Arcanedev\LogViewer\Commands
* @author ARCANEDEV
*/
class StatsCommand extends Command
diff --git a/src/Contracts/LogViewer.php b/src/Contracts/LogViewer.php
index 1a289606..0e2f20b3 100644
--- a/src/Contracts/LogViewer.php
+++ b/src/Contracts/LogViewer.php
@@ -7,7 +7,6 @@
/**
* Interface LogViewer
*
- * @package Arcanedev\LogViewer\Contracts
* @author ARCANEDEV
*/
interface LogViewer extends Patternable
diff --git a/src/Contracts/Patternable.php b/src/Contracts/Patternable.php
index c64884a6..0a1e5f48 100644
--- a/src/Contracts/Patternable.php
+++ b/src/Contracts/Patternable.php
@@ -9,7 +9,6 @@
/**
* Interface Patternable
*
- * @package Arcanedev\LogViewer\Contracts
* @author ARCANEDEV
*/
interface Patternable
diff --git a/src/Contracts/Table.php b/src/Contracts/Table.php
index 70b0bf84..6ded96cd 100644
--- a/src/Contracts/Table.php
+++ b/src/Contracts/Table.php
@@ -7,7 +7,6 @@
/**
* Interface Table
*
- * @package Arcanedev\LogViewer\Contracts
* @author ARCANEDEV
*/
interface Table
diff --git a/src/Contracts/Utilities/Factory.php b/src/Contracts/Utilities/Factory.php
index 1ead3251..8e94d7de 100644
--- a/src/Contracts/Utilities/Factory.php
+++ b/src/Contracts/Utilities/Factory.php
@@ -9,7 +9,6 @@
/**
* Interface Factory
*
- * @package Arcanedev\LogViewer\Contracts\Utilities
* @author ARCANEDEV
*/
interface Factory extends Patternable
diff --git a/src/Contracts/Utilities/Filesystem.php b/src/Contracts/Utilities/Filesystem.php
index 010d0703..95755763 100644
--- a/src/Contracts/Utilities/Filesystem.php
+++ b/src/Contracts/Utilities/Filesystem.php
@@ -9,7 +9,6 @@
/**
* Interface Filesystem
*
- * @package Arcanedev\LogViewer\Contracts\Utilities
* @author ARCANEDEV
*/
interface Filesystem extends Patternable
@@ -40,7 +39,7 @@ public function getInstance();
*
* @param string $storagePath
*
- * @return self
+ * @return $this
*/
public function setPath($storagePath);
@@ -49,7 +48,7 @@ public function setPath($storagePath);
*
* @param string $datePattern
*
- * @return self
+ * @return $this
*/
public function setDatePattern($datePattern);
@@ -58,7 +57,7 @@ public function setDatePattern($datePattern);
*
* @param string $prefixPattern
*
- * @return self
+ * @return $this
*/
public function setPrefixPattern($prefixPattern);
@@ -67,7 +66,7 @@ public function setPrefixPattern($prefixPattern);
*
* @param string $extension
*
- * @return self
+ * @return $this
*/
public function setExtension($extension);
@@ -119,7 +118,7 @@ public function read($date);
*
* @throws \Arcanedev\LogViewer\Exceptions\FilesystemException
*/
- public function delete($date);
+ public function delete(string $date);
/**
* Clear the log files.
diff --git a/src/Contracts/Utilities/LogChecker.php b/src/Contracts/Utilities/LogChecker.php
index e2d0ab18..70810cca 100644
--- a/src/Contracts/Utilities/LogChecker.php
+++ b/src/Contracts/Utilities/LogChecker.php
@@ -9,7 +9,6 @@
/**
* Interface LogChecker
*
- * @package Arcanedev\LogViewer\Contracts\Utilities
* @author ARCANEDEV
*/
interface LogChecker
diff --git a/src/Contracts/Utilities/LogLevels.php b/src/Contracts/Utilities/LogLevels.php
index 3b6a67b5..052daa13 100644
--- a/src/Contracts/Utilities/LogLevels.php
+++ b/src/Contracts/Utilities/LogLevels.php
@@ -9,7 +9,6 @@
/**
* Interface LogLevels
*
- * @package Arcanedev\LogViewer\Contracts\Utilities
* @author ARCANEDEV
*/
interface LogLevels
diff --git a/src/Contracts/Utilities/LogMenu.php b/src/Contracts/Utilities/LogMenu.php
index bb8a6537..c013033a 100644
--- a/src/Contracts/Utilities/LogMenu.php
+++ b/src/Contracts/Utilities/LogMenu.php
@@ -10,7 +10,6 @@
/**
* Interface LogMenu
*
- * @package Arcanedev\LogViewer\Contracts\Utilities
* @author ARCANEDEV
*/
interface LogMenu
diff --git a/src/Contracts/Utilities/LogStyler.php b/src/Contracts/Utilities/LogStyler.php
index e2190d65..a157354c 100644
--- a/src/Contracts/Utilities/LogStyler.php
+++ b/src/Contracts/Utilities/LogStyler.php
@@ -7,7 +7,6 @@
/**
* Interface LogStyler
*
- * @package Arcanedev\LogViewer\Contracts\Utilities
* @author ARCANEDEV
*/
interface LogStyler
diff --git a/src/Entities/Log.php b/src/Entities/Log.php
index 4735e569..0530eb2f 100644
--- a/src/Entities/Log.php
+++ b/src/Entities/Log.php
@@ -12,7 +12,6 @@
/**
* Class Log
*
- * @package Arcanedev\LogViewer\Entities
* @author ARCANEDEV
*/
class Log implements Arrayable, Jsonable, JsonSerializable
diff --git a/src/Entities/LogCollection.php b/src/Entities/LogCollection.php
index c27318ed..eeb964a0 100644
--- a/src/Entities/LogCollection.php
+++ b/src/Entities/LogCollection.php
@@ -12,7 +12,6 @@
/**
* Class LogCollection
*
- * @package Arcanedev\LogViewer\Entities
* @author ARCANEDEV
*/
class LogCollection extends LazyCollection
@@ -86,7 +85,7 @@ public function setFilesystem(FilesystemContract $filesystem)
public function get($date, $default = null)
{
if ( ! $this->has($date))
- throw new LogNotFoundException("Log not found in this date [$date]");
+ throw LogNotFoundException::make($date);
return parent::get($date, $default);
}
diff --git a/src/Entities/LogEntry.php b/src/Entities/LogEntry.php
index bda179b7..3508a7ba 100644
--- a/src/Entities/LogEntry.php
+++ b/src/Entities/LogEntry.php
@@ -12,7 +12,6 @@
/**
* Class LogEntry
*
- * @package Arcanedev\LogViewer\Entities
* @author ARCANEDEV
*/
class LogEntry implements Arrayable, Jsonable, JsonSerializable
diff --git a/src/Entities/LogEntryCollection.php b/src/Entities/LogEntryCollection.php
index 6077281c..4c534609 100644
--- a/src/Entities/LogEntryCollection.php
+++ b/src/Entities/LogEntryCollection.php
@@ -11,7 +11,6 @@
/**
* Class LogEntryCollection
*
- * @package Arcanedev\LogViewer\Entities
* @author ARCANEDEV
*/
class LogEntryCollection extends LazyCollection
diff --git a/src/Exceptions/FilesystemException.php b/src/Exceptions/FilesystemException.php
index 2d076334..414f3e78 100644
--- a/src/Exceptions/FilesystemException.php
+++ b/src/Exceptions/FilesystemException.php
@@ -7,7 +7,17 @@
/**
* Class FilesystemException
*
- * @package Arcanedev\LogViewer\Exceptions
* @author ARCANEDEV
*/
-class FilesystemException extends LogViewerException {}
+class FilesystemException extends LogViewerException
+{
+ public static function cannotDeleteLog()
+ {
+ return new static('There was an error deleting the log.');
+ }
+
+ public static function invalidPath(string $path)
+ {
+ return new static("The log(s) could not be located at : $path");
+ }
+}
diff --git a/src/Exceptions/LogNotFoundException.php b/src/Exceptions/LogNotFoundException.php
index 1bcd8dc4..96e34a34 100644
--- a/src/Exceptions/LogNotFoundException.php
+++ b/src/Exceptions/LogNotFoundException.php
@@ -7,7 +7,19 @@
/**
* Class LogNotFoundException
*
- * @package Arcanedev\LogViewer\Exceptions
* @author ARCANEDEV
*/
-class LogNotFoundException extends LogViewerException {}
+class LogNotFoundException extends LogViewerException
+{
+ /**
+ * Make the exception.
+ *
+ * @param string $date
+ *
+ * @return static
+ */
+ public static function make(string $date)
+ {
+ return new static("Log not found in this date [{$date}]");
+ }
+}
diff --git a/src/Exceptions/LogViewerException.php b/src/Exceptions/LogViewerException.php
index 51c4ff1f..db8e2fff 100644
--- a/src/Exceptions/LogViewerException.php
+++ b/src/Exceptions/LogViewerException.php
@@ -7,7 +7,6 @@
/**
* Class LogViewerException
*
- * @package Arcanedev\LogViewer\Exceptions
* @author ARCANEDEV
*/
class LogViewerException extends \Exception {}
diff --git a/src/Helpers/LogParser.php b/src/Helpers/LogParser.php
index 6a7187fa..56b9c978 100644
--- a/src/Helpers/LogParser.php
+++ b/src/Helpers/LogParser.php
@@ -10,7 +10,6 @@
/**
* Class LogParser
*
- * @package Arcanedev\LogViewer\Helpers
* @author ARCANEDEV
*/
class LogParser
diff --git a/src/Http/Controllers/LogViewerController.php b/src/Http/Controllers/LogViewerController.php
index ad6d5610..6b2203e1 100644
--- a/src/Http/Controllers/LogViewerController.php
+++ b/src/Http/Controllers/LogViewerController.php
@@ -16,7 +16,6 @@
/**
* Class LogViewerController
*
- * @package LogViewer\Http\Controllers
* @author ARCANEDEV
*/
class LogViewerController extends Controller
diff --git a/src/Http/Routes/LogViewerRoute.php b/src/Http/Routes/LogViewerRoute.php
index 0a1927a7..2a7161d8 100644
--- a/src/Http/Routes/LogViewerRoute.php
+++ b/src/Http/Routes/LogViewerRoute.php
@@ -10,10 +10,7 @@
/**
* Class LogViewerRoute
*
- * @package Arcanedev\LogViewer\Http\Routes
* @author ARCANEDEV
- *
- * @codeCoverageIgnore
*/
class LogViewerRoute extends RouteRegistrar
{
diff --git a/src/LogViewer.php b/src/LogViewer.php
index cef2fe61..2925970b 100644
--- a/src/LogViewer.php
+++ b/src/LogViewer.php
@@ -12,7 +12,6 @@
/**
* Class LogViewer
*
- * @package Arcanedev\LogViewer
* @author ARCANEDEV
*/
class LogViewer implements LogViewerContract
diff --git a/src/LogViewerServiceProvider.php b/src/LogViewerServiceProvider.php
index b30fbbe9..f26dab34 100644
--- a/src/LogViewerServiceProvider.php
+++ b/src/LogViewerServiceProvider.php
@@ -9,7 +9,6 @@
/**
* Class LogViewerServiceProvider
*
- * @package Arcanedev\LogViewer
* @author ARCANEDEV
*/
class LogViewerServiceProvider extends PackageServiceProvider
diff --git a/src/Providers/DeferredServicesProvider.php b/src/Providers/DeferredServicesProvider.php
index 10236dd2..a7713fb9 100644
--- a/src/Providers/DeferredServicesProvider.php
+++ b/src/Providers/DeferredServicesProvider.php
@@ -19,7 +19,6 @@
/**
* Class DeferredServicesProvider
*
- * @package Arcanedev\LogViewer\Providers
* @author ARCANEDEV
*/
class DeferredServicesProvider extends ServiceProvider implements DeferrableProvider
diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php
index f6559137..615ec30f 100644
--- a/src/Providers/RouteServiceProvider.php
+++ b/src/Providers/RouteServiceProvider.php
@@ -1,4 +1,8 @@
-
*/
class RouteServiceProvider extends ServiceProvider
@@ -16,24 +19,14 @@ class RouteServiceProvider extends ServiceProvider
| -----------------------------------------------------------------
*/
- /**
- * Get Route attributes
- *
- * @return array
- */
- public function routeAttributes()
- {
- return (array) $this->config('attributes');
- }
-
/**
* Check if routes is enabled
*
* @return bool
*/
- public function isEnabled()
+ public function isEnabled(): bool
{
- return $this->config('enabled', false);
+ return (bool) $this->config('enabled', false);
}
/* -----------------------------------------------------------------
@@ -42,14 +35,14 @@ public function isEnabled()
*/
/**
- * Define the routes for the application.
+ * Boot the service provider.
*/
- public function map(): void
+ public function boot(): void
{
if ($this->isEnabled()) {
- static::mapRouteClasses([
- LogViewerRoute::class,
- ]);
+ $this->routes(function () {
+ static::mapRouteClasses([LogViewerRoute::class]);
+ });
}
}
diff --git a/src/Tables/AbstractTable.php b/src/Tables/AbstractTable.php
index 88f9093f..e9175776 100644
--- a/src/Tables/AbstractTable.php
+++ b/src/Tables/AbstractTable.php
@@ -10,7 +10,6 @@
/**
* Class AbstractTable
*
- * @package Arcanedev\LogViewer\Bases
* @author ARCANEDEV
*/
abstract class AbstractTable implements TableContract
@@ -68,7 +67,7 @@ public function __construct(array $data, LogLevelsContract $levels, $locale = nu
*
* @param \Arcanedev\LogViewer\Contracts\Utilities\LogLevels $levels
*
- * @return self
+ * @return $this
*/
protected function setLevels(LogLevelsContract $levels)
{
@@ -82,7 +81,7 @@ protected function setLevels(LogLevelsContract $levels)
*
* @param string|null $locale
*
- * @return self
+ * @return $this
*/
protected function setLocale($locale)
{
@@ -140,7 +139,7 @@ public function data()
*
* @param array $data
*
- * @return self
+ * @return $this
*/
private function setData(array $data)
{
diff --git a/src/Tables/StatsTable.php b/src/Tables/StatsTable.php
index e96d0455..ecae5e75 100644
--- a/src/Tables/StatsTable.php
+++ b/src/Tables/StatsTable.php
@@ -10,7 +10,6 @@
/**
* Class StatsTable
*
- * @package Arcanedev\LogViewer\Tables
* @author ARCANEDEV
*/
class StatsTable extends AbstractTable
diff --git a/src/Utilities/Factory.php b/src/Utilities/Factory.php
index 5bd1d335..bfe597d6 100644
--- a/src/Utilities/Factory.php
+++ b/src/Utilities/Factory.php
@@ -13,7 +13,6 @@
/**
* Class Factory
*
- * @package Arcanedev\LogViewer\Utilities
* @author ARCANEDEV
*/
class Factory implements FactoryContract
diff --git a/src/Utilities/Filesystem.php b/src/Utilities/Filesystem.php
index ae078b14..d36b2af5 100644
--- a/src/Utilities/Filesystem.php
+++ b/src/Utilities/Filesystem.php
@@ -13,7 +13,6 @@
/**
* Class Filesystem
*
- * @package Arcanedev\LogViewer\Utilities
* @author ARCANEDEV
*/
class Filesystem implements FilesystemContract
@@ -96,7 +95,7 @@ public function getInstance()
*
* @param string $storagePath
*
- * @return self
+ * @return $this
*/
public function setPath($storagePath)
{
@@ -110,7 +109,7 @@ public function setPath($storagePath)
*
* @return string
*/
- public function getPattern()
+ public function getPattern(): string
{
return $this->prefixPattern.$this->datePattern.$this->extension;
}
@@ -122,7 +121,7 @@ public function getPattern()
* @param string $prefix
* @param string $extension
*
- * @return self
+ * @return $this
*/
public function setPattern(
$prefix = self::PATTERN_PREFIX,
@@ -141,7 +140,7 @@ public function setPattern(
*
* @param string $datePattern
*
- * @return self
+ * @return $this
*/
public function setDatePattern($datePattern)
{
@@ -155,7 +154,7 @@ public function setDatePattern($datePattern)
*
* @param string $prefixPattern
*
- * @return self
+ * @return $this
*/
public function setPrefixPattern($prefixPattern)
{
@@ -169,7 +168,7 @@ public function setPrefixPattern($prefixPattern)
*
* @param string $extension
*
- * @return self
+ * @return $this
*/
public function setExtension($extension)
{
@@ -254,15 +253,11 @@ public function read($date)
*
* @throws \Arcanedev\LogViewer\Exceptions\FilesystemException
*/
- public function delete($date)
+ public function delete(string $date)
{
$path = $this->getLogPath($date);
- // @codeCoverageIgnoreStart
- if ( ! $this->filesystem->delete($path)) {
- throw new FilesystemException('There was an error deleting the log.');
- }
- // @codeCoverageIgnoreEnd
+ throw_unless($this->filesystem->delete($path), FilesystemException::cannotDeleteLog());
return true;
}
@@ -274,9 +269,7 @@ public function delete($date)
*/
public function clear()
{
- return $this->filesystem->delete(
- $this->logs()
- );
+ return $this->filesystem->delete($this->logs());
}
/**
@@ -326,7 +319,7 @@ private function getLogPath(string $date)
$path = $this->storagePath.DIRECTORY_SEPARATOR.$this->prefixPattern.$date.$this->extension;
if ( ! $this->filesystem->exists($path)) {
- throw new FilesystemException("The log(s) could not be located at : $path");
+ throw FilesystemException::invalidPath($path);
}
return realpath($path);
diff --git a/src/Utilities/LogChecker.php b/src/Utilities/LogChecker.php
index 2454f0cb..c799e644 100644
--- a/src/Utilities/LogChecker.php
+++ b/src/Utilities/LogChecker.php
@@ -11,7 +11,6 @@
/**
* Class LogChecker
*
- * @package Arcanedev\LogViewer\Utilities
* @author ARCANEDEV
*/
class LogChecker implements LogCheckerContract
diff --git a/src/Utilities/LogLevels.php b/src/Utilities/LogLevels.php
index 4e17556a..d443c0e1 100644
--- a/src/Utilities/LogLevels.php
+++ b/src/Utilities/LogLevels.php
@@ -13,7 +13,6 @@
/**
* Class LogLevels
*
- * @package Arcanedev\LogViewer\Utilities
* @author ARCANEDEV
*/
class LogLevels implements LogLevelsContract
diff --git a/src/Utilities/LogMenu.php b/src/Utilities/LogMenu.php
index 0875a9db..663460a5 100644
--- a/src/Utilities/LogMenu.php
+++ b/src/Utilities/LogMenu.php
@@ -12,7 +12,6 @@
/**
* Class LogMenu
*
- * @package Arcanedev\LogViewer\Utilities
* @author ARCANEDEV
*/
class LogMenu implements LogMenuContract
diff --git a/src/Utilities/LogStyler.php b/src/Utilities/LogStyler.php
index 55d9c496..11728c4d 100644
--- a/src/Utilities/LogStyler.php
+++ b/src/Utilities/LogStyler.php
@@ -11,7 +11,6 @@
/**
* Class LogStyler
*
- * @package Arcanedev\LogViewer\Utilities
* @author ARCANEDEV
*/
class LogStyler implements LogStylerContract
diff --git a/tests/Commands/CheckCommandTest.php b/tests/Commands/CheckCommandTest.php
index dc32e7b6..87c578f5 100644
--- a/tests/Commands/CheckCommandTest.php
+++ b/tests/Commands/CheckCommandTest.php
@@ -9,7 +9,6 @@
/**
* Class CheckCommandTest
*
- * @package Arcanedev\LogViewer\Tests\Commands
* @author ARCANEDEV
*/
class CheckCommandTest extends TestCase
diff --git a/tests/Commands/ClearCommandTest.php b/tests/Commands/ClearCommandTest.php
index d42639a8..54e4c39f 100644
--- a/tests/Commands/ClearCommandTest.php
+++ b/tests/Commands/ClearCommandTest.php
@@ -9,7 +9,6 @@
/**
* Class ClearCommandTest
*
- * @package Arcanedev\LogViewer\Tests\Commands
* @author ARCANEDEV
*/
class ClearCommandTest extends TestCase
diff --git a/tests/Commands/PublishCommandTest.php b/tests/Commands/PublishCommandTest.php
index 0bb5b49f..383edc8f 100644
--- a/tests/Commands/PublishCommandTest.php
+++ b/tests/Commands/PublishCommandTest.php
@@ -9,7 +9,6 @@
/**
* Class PublishCommandTest
*
- * @package Arcanedev\LogViewer\Tests\Commands
* @author ARCANEDEV
*/
class PublishCommandTest extends TestCase
@@ -109,7 +108,7 @@ protected function assertHasConfigFile(): void
*/
protected function assertHasNotConfigFile(): void
{
- static::assertFileNotExists($this->getConfigFilePath());
+ static::assertFileDoesNotExist($this->getConfigFilePath());
static::assertFalse($this->isConfigExists());
}
diff --git a/tests/Commands/StatsCommandTest.php b/tests/Commands/StatsCommandTest.php
index a1a8f572..588d8fd3 100644
--- a/tests/Commands/StatsCommandTest.php
+++ b/tests/Commands/StatsCommandTest.php
@@ -9,7 +9,6 @@
/**
* Class StatsCommandTest
*
- * @package Arcanedev\LogViewer\Tests\Commands
* @author ARCANEDEV
*/
class StatsCommandTest extends TestCase
diff --git a/tests/Entities/LogCollectionTest.php b/tests/Entities/LogCollectionTest.php
index eea42550..aaf07512 100644
--- a/tests/Entities/LogCollectionTest.php
+++ b/tests/Entities/LogCollectionTest.php
@@ -11,7 +11,6 @@
/**
* Class LogCollectionTest
*
- * @package Arcanedev\LogViewer\Tests\Entities
* @author ARCANEDEV
*/
class LogCollectionTest extends TestCase
diff --git a/tests/Entities/LogEntryCollectionTest.php b/tests/Entities/LogEntryCollectionTest.php
index 4083bc39..0d819700 100644
--- a/tests/Entities/LogEntryCollectionTest.php
+++ b/tests/Entities/LogEntryCollectionTest.php
@@ -10,7 +10,6 @@
/**
* Class LogEntryCollectionTest
*
- * @package Arcanedev\LogViewer\Tests\Entities
* @author ARCANEDEV
*/
class LogEntryCollectionTest extends TestCase
diff --git a/tests/Entities/LogEntryTest.php b/tests/Entities/LogEntryTest.php
index 71b27fd9..78f30fe9 100644
--- a/tests/Entities/LogEntryTest.php
+++ b/tests/Entities/LogEntryTest.php
@@ -10,7 +10,6 @@
/**
* Class LogEntryTest
*
- * @package Arcanedev\LogViewer\Tests\Entities
* @author ARCANEDEV
*/
class LogEntryTest extends TestCase
diff --git a/tests/Entities/LogTest.php b/tests/Entities/LogTest.php
index 504e81f5..7a42fa1a 100644
--- a/tests/Entities/LogTest.php
+++ b/tests/Entities/LogTest.php
@@ -10,7 +10,6 @@
/**
* Class LogTest
*
- * @package Arcanedev\LogViewer\Tests\Entities
* @author ARCANEDEV
*/
class LogTest extends TestCase
diff --git a/tests/LogViewerServiceProviderTest.php b/tests/LogViewerServiceProviderTest.php
index 824ba87a..434e9030 100644
--- a/tests/LogViewerServiceProviderTest.php
+++ b/tests/LogViewerServiceProviderTest.php
@@ -9,7 +9,6 @@
/**
* Class LogViewerServiceProviderTest
*
- * @package Arcanedev\LogViewer\Tests
* @author ARCANEDEV
*/
class LogViewerServiceProviderTest extends TestCase
diff --git a/tests/LogViewerTest.php b/tests/LogViewerTest.php
index 13f1d685..a565dd76 100644
--- a/tests/LogViewerTest.php
+++ b/tests/LogViewerTest.php
@@ -10,7 +10,6 @@
/**
* Class LogViewerTest
*
- * @package Arcanedev\LogViewer\Tests
* @author ARCANEDEV
*/
class LogViewerTest extends TestCase
diff --git a/tests/Providers/DeferredServicesProviderTest.php b/tests/Providers/DeferredServicesProviderTest.php
index e39c0e50..5af0bd54 100644
--- a/tests/Providers/DeferredServicesProviderTest.php
+++ b/tests/Providers/DeferredServicesProviderTest.php
@@ -11,7 +11,6 @@
/**
* Class DeferredServicesProviderTest
*
- * @package Arcanedev\LogViewer\Tests\Providers
* @author ARCANEDEV
*/
class DeferredServicesProviderTest extends TestCase
diff --git a/tests/RoutesTest.php b/tests/RoutesTest.php
index b26c3132..63a520d9 100644
--- a/tests/RoutesTest.php
+++ b/tests/RoutesTest.php
@@ -7,10 +7,7 @@
/**
* Class RoutesTest
*
- * @package Arcanedev\LogViewer\Tests
* @author ARCANEDEV
- *
- * @todo: Find a way to test the route Classes with testbench (Find another tool if it's impossible).
*/
class RoutesTest extends TestCase
{
@@ -165,6 +162,16 @@ public function it_can_still_search_if_extra_spacing_is_in_query(): void
static::assertCount(1, $entries);
}
+ /** @test */
+ public function it_must_redirect_if_search_query_is_not_available(): void
+ {
+ $date = '2015-01-01';
+ $level = 'notice';
+
+ $this->get(route('log-viewer::logs.search', compact('date', 'level')))
+ ->assertRedirect(route('log-viewer::logs.show', [$date]));
+ }
+
/** @test */
public function it_must_redirect_on_all_level(): void
{
diff --git a/tests/Tables/StatsTableTest.php b/tests/Tables/StatsTableTest.php
index d1104f6f..fa1de8f2 100644
--- a/tests/Tables/StatsTableTest.php
+++ b/tests/Tables/StatsTableTest.php
@@ -11,7 +11,6 @@
/**
* Class StatsTableTest
*
- * @package Arcanedev\LogViewer\Tests\Tables
* @author ARCANEDEV
*/
class StatsTableTest extends TestCase
diff --git a/tests/TestCase.php b/tests/TestCase.php
index 7a11fb94..ce3b8c5a 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -22,7 +22,6 @@
/**
* Class TestCase
*
- * @package Arcanedev\LogViewer\Tests
* @author ARCANEDEV
*/
abstract class TestCase extends BaseTestCase
diff --git a/tests/Utilities/FactoryTest.php b/tests/Utilities/FactoryTest.php
index 58099f63..afd26f7a 100644
--- a/tests/Utilities/FactoryTest.php
+++ b/tests/Utilities/FactoryTest.php
@@ -10,7 +10,6 @@
/**
* Class FactoryTest
*
- * @package Arcanedev\LogViewer\Tests\Utilities
* @author ARCANEDEV
*/
class FactoryTest extends TestCase
diff --git a/tests/Utilities/FilesystemTest.php b/tests/Utilities/FilesystemTest.php
index e73b4b6d..be7724ba 100644
--- a/tests/Utilities/FilesystemTest.php
+++ b/tests/Utilities/FilesystemTest.php
@@ -10,7 +10,6 @@
/**
* Class FilesystemTest
*
- * @package Arcanedev\LogViewer\Tests\Utilities
* @author ARCANEDEV
*/
class FilesystemTest extends TestCase
diff --git a/tests/Utilities/LogCheckerTest.php b/tests/Utilities/LogCheckerTest.php
index d7d8e1ea..630e86eb 100644
--- a/tests/Utilities/LogCheckerTest.php
+++ b/tests/Utilities/LogCheckerTest.php
@@ -10,7 +10,6 @@
/**
* Class LogCheckerTest
*
- * @package Arcanedev\LogViewer\Tests\Utilities
* @author ARCANEDEV
*/
class LogCheckerTest extends TestCase
diff --git a/tests/Utilities/LogLevelsTest.php b/tests/Utilities/LogLevelsTest.php
index 9361733e..4a80dee1 100644
--- a/tests/Utilities/LogLevelsTest.php
+++ b/tests/Utilities/LogLevelsTest.php
@@ -10,7 +10,6 @@
/**
* Class LogLevelsTest
*
- * @package Arcanedev\LogViewer\Tests\Utilities
* @author ARCANEDEV
*/
class LogLevelsTest extends TestCase
diff --git a/tests/Utilities/LogMenuTest.php b/tests/Utilities/LogMenuTest.php
index 386f5c4f..5d2364e5 100644
--- a/tests/Utilities/LogMenuTest.php
+++ b/tests/Utilities/LogMenuTest.php
@@ -10,7 +10,6 @@
/**
* Class LogMenuTest
*
- * @package Arcanedev\LogViewer\Tests\Utilities
* @author ARCANEDEV
*/
class LogMenuTest extends TestCase
diff --git a/tests/Utilities/LogStylerTest.php b/tests/Utilities/LogStylerTest.php
index f88638c8..5c449036 100644
--- a/tests/Utilities/LogStylerTest.php
+++ b/tests/Utilities/LogStylerTest.php
@@ -11,7 +11,6 @@
/**
* Class LogStylerTest
*
- * @package Arcanedev\LogViewer\Tests\Utilities
* @author ARCANEDEV
*/
class LogStylerTest extends TestCase