Resolved phpcs Generic standard rules

pull/567/head
fadrian06 11 months ago
parent 253c86482e
commit 86df1cb2bd

@ -262,12 +262,14 @@ class RouterTest extends TestCase
{ {
$this->router->map('GET /api/intune/hey', [$this, 'ok']); $this->router->map('GET /api/intune/hey', [$this, 'ok']);
$error_description = 'error_description=AADSTS65004%3a+User+declined+to+consent+to+access+the';
$error_description .= '+app.%0d%0aTrace+ID%3a+747c0cc1-ccbd-4e53-8e2f-48812eb24100%0d%0a';
$error_description .= 'Correlation+ID%3a+362e3cb3-20ef-400b-904e-9983bd989184%0d%0a';
$error_description .= 'Timestamp%3a+2022-09-08+09%3a58%3a12Z';
$query_params = [ $query_params = [
'error=access_denied', 'error=access_denied',
'error_description=AADSTS65004%3a+User+declined+to+consent+to+access+the' $error_description,
. '+app.%0d%0aTrace+ID%3a+747c0cc1-ccbd-4e53-8e2f-48812eb24100%0d%0a'
. 'Correlation+ID%3a+362e3cb3-20ef-400b-904e-9983bd989184%0d%0a'
. 'Timestamp%3a+2022-09-08+09%3a58%3a12Z',
'error_uri=https%3a%2f%2flogin.microsoftonline.com%2ferror%3fcode%3d65004', 'error_uri=https%3a%2f%2flogin.microsoftonline.com%2ferror%3fcode%3d65004',
'admin_consent=True', 'admin_consent=True',
'state=x2EUE0fcSj#' 'state=x2EUE0fcSj#'

@ -9,7 +9,9 @@ declare(strict_types=1);
* @author Kristaps Muižnieks https://github.com/krmu * @author Kristaps Muižnieks https://github.com/krmu
*/ */
require file_exists(__DIR__ . '/../../vendor/autoload.php') ? __DIR__ . '/../../vendor/autoload.php' : __DIR__ . '/../../flight/autoload.php'; require_once file_exists(__DIR__ . '/../../vendor/autoload.php')
? __DIR__ . '/../../vendor/autoload.php'
: __DIR__ . '/../../flight/autoload.php';
Flight::set('flight.content_length', false); Flight::set('flight.content_length', false);
Flight::set('flight.views.path', './'); Flight::set('flight.views.path', './');
@ -95,17 +97,23 @@ Flight::group('', function () {
Flight::route('/error', function () { Flight::route('/error', function () {
trigger_error('This is a successful error'); trigger_error('This is a successful error');
}); });
}, [ new LayoutMiddleware() ]); }, [new LayoutMiddleware()]);
Flight::map('error', function (Throwable $e) { Flight::map('error', function (Throwable $e) {
$styles = join(';', [
'border: 2px solid red',
'padding: 21px',
'background: lightgray',
'font-weight: bold'
]);
echo sprintf( echo sprintf(
'<h1>500 Internal Server Error</h1>' . "<h1>500 Internal Server Error</h1><h3>%s (%s)</h3><pre style=\"$styles\">%s</pre>",
'<h3>%s (%s)</h3>' .
'<pre style="border: 2px solid red; padding: 21px; background: lightgray; font-weight: bold;">%s</pre>',
$e->getMessage(), $e->getMessage(),
$e->getCode(), $e->getCode(),
str_replace(getenv('PWD'), '***CONFIDENTIAL***', $e->getTraceAsString()) str_replace(getenv('PWD'), '***CONFIDENTIAL***', $e->getTraceAsString())
); );
echo "<br><a href='/'>Go back</a>"; echo "<br><a href='/'>Go back</a>";
}); });
Flight::map('notFound', function () { Flight::map('notFound', function () {

Loading…
Cancel
Save