-
Notifications
You must be signed in to change notification settings - Fork 10
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
2 changed files
with
31 additions
and
16 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 |
---|---|---|
@@ -1,33 +1,48 @@ | ||
<?php | ||
/* | ||
* Ce fichier fait partie du edu-framework. | ||
* Ce fichier fait partie du Studoo | ||
* | ||
* (c) Studoo | ||
* @author Benoit Foujols | ||
* | ||
* Pour les informations complètes sur les droits d'auteur et la licence, | ||
* veuillez consulter le fichier LICENSE qui a été distribué avec ce code source. | ||
*/ | ||
|
||
|
||
namespace Studoo\EduFramework\Core\View; | ||
|
||
use Twig\Extension\AbstractExtension; | ||
|
||
/** | ||
* Class StudooDebugExtension | ||
* Elle permet de déclarer les fonctions de l'extension dd() | ||
* @package Studoo\EduFramework\Core\View | ||
*/ | ||
class StudooDebugExtension extends AbstractExtension | ||
{ | ||
/** | ||
* Permet de déclarer les fonctions de l'extension | ||
* @return \Twig\TwigFunction[] | ||
*/ | ||
public function getFunctions(): array | ||
{ | ||
return [ | ||
new \Twig\TwigFunction('dd', [$this, 'dd']), | ||
]; | ||
} | ||
|
||
public function dd($var): void | ||
/** | ||
* Permet d'afficher le contenu d'une variable | ||
* @param string $var | ||
* @return void | ||
*/ | ||
public function dd(string $var): void | ||
Check notice on line 38 in src/EduFramework/Core/View/StudooDebugExtension.php Codacy Production / Codacy Static Code Analysissrc/EduFramework/Core/View/StudooDebugExtension.php#L38
|
||
{ | ||
ob_start(); | ||
var_dump($var); | ||
$result = ob_get_clean(); | ||
|
||
echo "<div style=\"background-color: grey; color: white; padding: 10px; margin: 10px 0;\"><pre>{$result}</pre></div>"; | ||
echo "<div style=\"background-color: grey; color: white; padding: 10px; margin: 10px 0;\"> | ||
Check failure on line 44 in src/EduFramework/Core/View/StudooDebugExtension.php Codacy Production / Codacy Static Code Analysissrc/EduFramework/Core/View/StudooDebugExtension.php#L44
|
||
<pre>{$result}</pre> | ||
</div>"; | ||
} | ||
} | ||
} |