-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
356 additions
and
90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
<?php | ||
|
||
namespace App\Console; | ||
|
||
use Slim\Console\App; | ||
|
||
class Application extends App { | ||
class Application extends App | ||
{ | ||
} |
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
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,12 @@ | ||
<?php | ||
|
||
namespace App\Core\Cookies; | ||
|
||
use App\Providers\ServiceProvider; | ||
|
||
class CookieServiceProvider extends ServiceProvider | ||
{ | ||
public function register() | ||
{ | ||
} | ||
} |
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,88 @@ | ||
<?php | ||
|
||
namespace App\Core\Log; | ||
|
||
use App\Core\Helper; | ||
use App\Core\Settings\SettingsInterface; | ||
use App\Http\Handlers\HttpErrorHandler; | ||
use App\Http\Handlers\ShutdownHandler; | ||
use App\Providers\ServiceProvider; | ||
use Psr\Container\ContainerInterface; | ||
use ReflectionClass; | ||
use Slim\Factory\ServerRequestCreatorFactory; | ||
|
||
class LogServiceProvider extends ServiceProvider | ||
{ | ||
protected function setupDashboardEnvironment($isDashboard) | ||
{ | ||
$helperRelf = new ReflectionClass(Helper::class); | ||
$isDashboardProperty = $helperRelf->getProperty('isDashboard'); | ||
$isDashboardProperty->setAccessible(true); | ||
$isDashboardProperty->setValue($isDashboardProperty, $isDashboard); | ||
$isDashboardProperty->setAccessible(false); | ||
} | ||
|
||
protected function setupHttpErrorHandle() | ||
{ | ||
/** | ||
* @var ContainerInterface | ||
*/ | ||
$container = $this->app->getContainer(); | ||
|
||
/** @var SettingsInterface $settings */ | ||
$settings = $container->get(SettingsInterface::class); | ||
|
||
$displayErrorDetails = $settings->get('displayErrorDetails'); | ||
|
||
// Create Request object from globals | ||
$serverRequestCreator = ServerRequestCreatorFactory::create(); | ||
$request = $serverRequestCreator->createServerRequestFromGlobals(); | ||
|
||
$requestPath = $request->getUri() != null ? $request->getUri()->getPath() : '/'; | ||
$isDashboard = $requestPath === $settings->get('admin_prefix', '/dashboard') | ||
|| strpos($requestPath, $settings->get('admin_prefix', '/dashboard') . '/') === 0; | ||
|
||
$container->set('is_dashboard', $isDashboard); | ||
|
||
$this->setupDashboardEnvironment($isDashboard); | ||
|
||
$responseFactory = $this->app->getResponseFactory(); | ||
$callableResolver = $this->app->getCallableResolver(); | ||
$errorHandler = new HttpErrorHandler($callableResolver, $responseFactory); | ||
|
||
// Create Shutdown Handler | ||
$shutdownHandler = new ShutdownHandler($request, $errorHandler, $displayErrorDetails); | ||
register_shutdown_function($shutdownHandler); | ||
|
||
return $errorHandler; | ||
} | ||
|
||
protected function writeErrorLogs(HttpErrorHandler $errorHandler) | ||
{ | ||
/** | ||
* @var ContainerInterface | ||
*/ | ||
$container = $this->app->getContainer(); | ||
$settings = $container->get(SettingsInterface::class); | ||
|
||
$displayErrorDetails = $settings->get('displayErrorDetails'); | ||
$logError = $settings->get('logError'); | ||
$logErrorDetails = $settings->get('logErrorDetails'); | ||
|
||
// Add Error Middleware | ||
$errorMiddleware = $this->app->addErrorMiddleware($displayErrorDetails, $logError, $logErrorDetails); | ||
$errorMiddleware->setDefaultErrorHandler($errorHandler); | ||
} | ||
|
||
public function register() | ||
{ | ||
$this->writeErrorLogs( | ||
$this->setupHttpErrorHandle() | ||
); | ||
} | ||
|
||
public function boot() | ||
{ | ||
die('zo'); | ||
} | ||
} |
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
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.