-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow different checks for dev/production modes
- Loading branch information
Showing
9 changed files
with
305 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace BeyondCode\SelfDiagnosis\Checks\Development; | ||
|
||
use BeyondCode\SelfDiagnosis\Checks\Check; | ||
|
||
class ConfigurationIsNotCached implements Check | ||
{ | ||
|
||
/** | ||
* The name of the check. | ||
* | ||
* @return string | ||
*/ | ||
public function name(): string | ||
{ | ||
return 'Configuration is not cached'; | ||
} | ||
|
||
/** | ||
* Perform the actual verification of this check. | ||
* | ||
* @return bool | ||
*/ | ||
public function check(): bool | ||
{ | ||
return app()->configurationIsCached() === false; | ||
} | ||
|
||
/** | ||
* The error message to display in case the check does not pass. | ||
* | ||
* @return string | ||
*/ | ||
public function message(): string | ||
{ | ||
return 'Your configuration files should not be cached during development. Call "php artisan config:clear" to clear the config cache.'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace BeyondCode\SelfDiagnosis\Checks\Development; | ||
|
||
use BeyondCode\SelfDiagnosis\Checks\Check; | ||
|
||
class RoutesAreNotCached implements Check | ||
{ | ||
|
||
/** | ||
* The name of the check. | ||
* | ||
* @return string | ||
*/ | ||
public function name(): string | ||
{ | ||
return 'Routes are not cached'; | ||
} | ||
|
||
/** | ||
* Perform the actual verification of this check. | ||
* | ||
* @return bool | ||
*/ | ||
public function check(): bool | ||
{ | ||
return app()->routesAreCached() === false; | ||
} | ||
|
||
/** | ||
* The error message to display in case the check does not pass. | ||
* | ||
* @return string | ||
*/ | ||
public function message(): string | ||
{ | ||
return 'Your routes should not be cached during development. Call "php artisan route:clear" to clear the route cache.'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace BeyondCode\SelfDiagnosis\Checks\Production; | ||
|
||
use BeyondCode\SelfDiagnosis\Checks\Check; | ||
|
||
class ConfigurationIsCached implements Check | ||
{ | ||
|
||
/** | ||
* The name of the check. | ||
* | ||
* @return string | ||
*/ | ||
public function name(): string | ||
{ | ||
return 'Configuration is cached'; | ||
} | ||
|
||
/** | ||
* Perform the actual verification of this check. | ||
* | ||
* @return bool | ||
*/ | ||
public function check(): bool | ||
{ | ||
return app()->configurationIsCached() === true; | ||
} | ||
|
||
/** | ||
* The error message to display in case the check does not pass. | ||
* | ||
* @return string | ||
*/ | ||
public function message(): string | ||
{ | ||
return 'Your configuration files should be cached in production. Call "php artisan config:cache" to cache the configuration.'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace BeyondCode\SelfDiagnosis\Checks\Production; | ||
|
||
use BeyondCode\SelfDiagnosis\Checks\Check; | ||
|
||
class DebugModeIsNotEnabled implements Check | ||
{ | ||
|
||
/** | ||
* The name of the check. | ||
* | ||
* @return string | ||
*/ | ||
public function name(): string | ||
{ | ||
return 'Debug mode is not enabled'; | ||
} | ||
|
||
/** | ||
* Perform the actual verification of this check. | ||
* | ||
* @return bool | ||
*/ | ||
public function check(): bool | ||
{ | ||
return config('app.debug') === false; | ||
} | ||
|
||
/** | ||
* The error message to display in case the check does not pass. | ||
* | ||
* @return string | ||
*/ | ||
public function message(): string | ||
{ | ||
return 'You should not use debug mode in production. Set APP_DEBUG to false.'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace BeyondCode\SelfDiagnosis\Checks\Production; | ||
|
||
use BeyondCode\SelfDiagnosis\Checks\Check; | ||
|
||
class RoutesAreCached implements Check | ||
{ | ||
|
||
/** | ||
* The name of the check. | ||
* | ||
* @return string | ||
*/ | ||
public function name(): string | ||
{ | ||
return 'Routes are cached'; | ||
} | ||
|
||
/** | ||
* Perform the actual verification of this check. | ||
* | ||
* @return bool | ||
*/ | ||
public function check(): bool | ||
{ | ||
return app()->routesAreCached() === true; | ||
} | ||
|
||
/** | ||
* The error message to display in case the check does not pass. | ||
* | ||
* @return string | ||
*/ | ||
public function message(): string | ||
{ | ||
return 'Your routes should be cached in production. Call "php artisan route:cache" to create the route cache.'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace BeyondCode\SelfDiagnosis\Checks\Production; | ||
|
||
use BeyondCode\SelfDiagnosis\Checks\Check; | ||
|
||
class XDebugIsNotEnabled implements Check | ||
{ | ||
|
||
/** | ||
* The name of the check. | ||
* | ||
* @return string | ||
*/ | ||
public function name(): string | ||
{ | ||
return 'The xdebug extension is not active.'; | ||
} | ||
|
||
/** | ||
* Perform the actual verification of this check. | ||
* | ||
* @return bool | ||
*/ | ||
public function check(): bool | ||
{ | ||
return extension_loaded('xdebug') === true; | ||
} | ||
|
||
/** | ||
* The error message to display in case the check does not pass. | ||
* | ||
* @return string | ||
*/ | ||
public function message(): string | ||
{ | ||
return 'You should not have the "xdebug" PHP extension activated in production.'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters