-
Notifications
You must be signed in to change notification settings - Fork 0
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
Quentin Schuler
committed
Feb 19, 2018
0 parents
commit 6a92107
Showing
9 changed files
with
280 additions
and
0 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
/vendor/ |
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,19 @@ | ||
Copyright (c) 2018 Quentin Schuler | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is furnished | ||
to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
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,10 @@ | ||
BSOD Bundle | ||
=========== | ||
|
||
You always wanted to do some .NET shit but only knows PHP? Do yourself a favor and install that Symfony bundle. Now, you | ||
are a real developer. | ||
|
||
Pro Tip | ||
------- | ||
|
||
For a better effect, switch your browser to full-screen. |
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,22 @@ | ||
{ | ||
"name": "sukei/bsod-bundle", | ||
"description": "Give to your development environment a Windows look & feel.", | ||
"keywords": ["symfony", "exception", "bsod", "windows"], | ||
"type": "symfony-bundle", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Quentin Schuler", | ||
"email": "qschuler@neosyne.com" | ||
} | ||
], | ||
"require": { | ||
"symfony/templating": "^4.0", | ||
"symfony/twig-bundle": "^4.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Sukei\\Bundle\\BsodBundle\\": "src/" | ||
} | ||
} | ||
} |
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,32 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the BSOD Bundle. | ||
* | ||
* (c) Quentin Schuler <qschuler@neosyne.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sukei\Bundle\BsodBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Extension\Extension; | ||
use Symfony\Component\DependencyInjection\Loader; | ||
|
||
/** | ||
* @author Quentin Schuler <qschuler@neosyne.com> | ||
*/ | ||
class SukeiBsodExtension extends Extension | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function load(array $configs, ContainerBuilder $container) | ||
{ | ||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); | ||
$loader->load('services.yaml'); | ||
} | ||
} |
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,45 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the BSOD Bundle. | ||
* | ||
* (c) Quentin Schuler <qschuler@neosyne.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sukei\Bundle\BsodBundle\EventListener; | ||
|
||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; | ||
use Symfony\Component\Templating\EngineInterface; | ||
|
||
/** | ||
* @author Quentin Schuler <qschuler@neosyne.com> | ||
*/ | ||
class ExceptionListener | ||
{ | ||
/** | ||
* @var EngineInterface | ||
*/ | ||
private $engine; | ||
|
||
/** | ||
* @param EngineInterface $engine | ||
*/ | ||
public function __construct(EngineInterface $engine) | ||
{ | ||
$this->engine = $engine; | ||
} | ||
|
||
/** | ||
* @param GetResponseForExceptionEvent $event | ||
*/ | ||
public function onKernelException(GetResponseForExceptionEvent $event) | ||
{ | ||
$event->setResponse(new Response($this->engine->render('@SukeiBsodBundle/Resources/views/bsod.html.twig', [ | ||
'exception' => $event->getException(), | ||
]))); | ||
} | ||
} |
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,8 @@ | ||
services: | ||
_defaults: | ||
autowire: true | ||
|
||
Sukei\Bundle\BsodBundle\EventListener\ExceptionListener: | ||
tags: | ||
- { name: kernel.event_listener, event: kernel.exception, method: onKernelException } | ||
|
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,121 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Boom!</title> | ||
<style> | ||
html, | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: #0000aa; | ||
color: #cccccc; | ||
} | ||
.exception { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
font-family: "Lucida Console", monospace; | ||
} | ||
.exception__block { | ||
width: 80ch; | ||
} | ||
.exception__title { | ||
display: inline; | ||
text-align: center; | ||
background-color: #cccccc; | ||
color: #0000aa; | ||
} | ||
.exception__center, | ||
.exception__title, | ||
.exception__message, | ||
.exception__trace, | ||
.exception__trace-item { | ||
font-size: 1rem; | ||
} | ||
.exception__center, | ||
.exception__title, | ||
.exception__message, | ||
.exception__trace { | ||
margin-top: 2rem; | ||
margin-bottom: 2rem; | ||
} | ||
.exception__trace { | ||
padding-left: 0; | ||
} | ||
.exception__trace-item { | ||
list-style: none; | ||
} | ||
.exception__trace-item::before { | ||
content: "* "; | ||
} | ||
.exception__center { | ||
text-align: center; | ||
} | ||
.blink { | ||
animation: blink 1s step-end infinite; | ||
} | ||
a { | ||
text-decoration: none; | ||
color: inherit; | ||
} | ||
@-webkit-keyframes blink { | ||
67% { opacity: 0 } | ||
} | ||
@-moz-keyframes blink { | ||
67% { opacity: 0 } | ||
} | ||
@-o-keyframes blink { | ||
67% { opacity: 0 } | ||
} | ||
@keyframes blink { | ||
67% { opacity: 0 } | ||
} | ||
</style> | ||
</head> | ||
<body class="exception"> | ||
<div class="exception__block"> | ||
<h1 class="exception__center"> | ||
<span class="exception__title">Symfony</span> | ||
</h1> | ||
<div class="exception__message">{{ exception.message|nl2br }}</div> | ||
<ul class="exception__trace"> | ||
{% for trace in exception.trace %} | ||
{% if trace.file|default(false) %} | ||
{% set line_number = trace.line|default(1) %} | ||
{% set file_link = trace.file|file_link(line_number) %} | ||
{% set file_path = trace.file|format_file(line_number)|striptags|replace({ (' at line ' ~ line_number): '' }) %} | ||
{% set file_path_parts = file_path|split(constant('DIRECTORY_SEPARATOR')) %} | ||
|
||
<li class="exception__trace-item"> | ||
in | ||
<a href="{{ file_link }}">{{ file_path_parts[:-1]|join(constant('DIRECTORY_SEPARATOR')) }}{{ constant('DIRECTORY_SEPARATOR') }}{{ file_path_parts|last }}</a> | ||
(line {{ line_number }}) | ||
</li> | ||
{% endif %} | ||
{% endfor %} | ||
</ul> | ||
<div class="exception__message">Contact your god or technical support group for further assistance.</div> | ||
<div class="exception__center"> | ||
<span class="exception__message">Press any key to give up <span class="blink">_</span></span> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
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,22 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the BSOD Bundle. | ||
* | ||
* (c) Quentin Schuler <qschuler@neosyne.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sukei\Bundle\BsodBundle; | ||
|
||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
/** | ||
* @author Quentin Schuler <qschuler@neosyne.com> | ||
*/ | ||
class SukeiBsodBundle extends Bundle | ||
{ | ||
} | ||
|