summaryrefslogtreecommitdiff
path: root/inc/lib/Twig/Extension/Debug.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/lib/Twig/Extension/Debug.php')
-rw-r--r--inc/lib/Twig/Extension/Debug.php67
1 files changed, 0 insertions, 67 deletions
diff --git a/inc/lib/Twig/Extension/Debug.php b/inc/lib/Twig/Extension/Debug.php
deleted file mode 100644
index d0cd1962..00000000
--- a/inc/lib/Twig/Extension/Debug.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-/*
- * This file is part of Twig.
- *
- * (c) Fabien Potencier
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * @final
- */
-class Twig_Extension_Debug extends Twig_Extension
-{
- public function getFunctions()
- {
- // dump is safe if var_dump is overridden by xdebug
- $isDumpOutputHtmlSafe = extension_loaded('xdebug')
- // false means that it was not set (and the default is on) or it explicitly enabled
- && (false === ini_get('xdebug.overload_var_dump') || ini_get('xdebug.overload_var_dump'))
- // false means that it was not set (and the default is on) or it explicitly enabled
- // xdebug.overload_var_dump produces HTML only when html_errors is also enabled
- && (false === ini_get('html_errors') || ini_get('html_errors'))
- || 'cli' === PHP_SAPI
- ;
-
- return array(
- new Twig_SimpleFunction('dump', 'twig_var_dump', array('is_safe' => $isDumpOutputHtmlSafe ? array('html') : array(), 'needs_context' => true, 'needs_environment' => true)),
- );
- }
-
- public function getName()
- {
- return 'debug';
- }
-}
-
-function twig_var_dump(Twig_Environment $env, $context)
-{
- if (!$env->isDebug()) {
- return;
- }
-
- ob_start();
-
- $count = func_num_args();
- if (2 === $count) {
- $vars = array();
- foreach ($context as $key => $value) {
- if (!$value instanceof Twig_Template) {
- $vars[$key] = $value;
- }
- }
-
- var_dump($vars);
- } else {
- for ($i = 2; $i < $count; ++$i) {
- var_dump(func_get_arg($i));
- }
- }
-
- return ob_get_clean();
-}
-
-class_alias('Twig_Extension_Debug', 'Twig\Extension\DebugExtension', false);