dependencies-upgrade
This commit is contained in:
		
							
								
								
									
										19
									
								
								vendor/maximebf/debugbar/LICENSE
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								vendor/maximebf/debugbar/LICENSE
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| Copyright (C) 2013 Maxime Bouroumeau-Fuseau | ||||
|  | ||||
| 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. | ||||
							
								
								
									
										43
									
								
								vendor/maximebf/debugbar/composer.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								vendor/maximebf/debugbar/composer.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,43 @@ | ||||
| { | ||||
|     "name": "maximebf/debugbar", | ||||
|     "description": "Debug bar in the browser for php application", | ||||
|     "keywords": ["debug", "debugbar"], | ||||
|     "homepage": "https://github.com/maximebf/php-debugbar", | ||||
|     "type": "library", | ||||
|     "license": "MIT", | ||||
|     "authors": [ | ||||
|         { | ||||
|             "name": "Maxime Bouroumeau-Fuseau", | ||||
|             "email": "maxime.bouroumeau@gmail.com", | ||||
|             "homepage": "http://maximebf.com" | ||||
|         }, | ||||
|         { | ||||
|             "name": "Barry vd. Heuvel", | ||||
|             "email": "barryvdh@gmail.com" | ||||
|         } | ||||
|     ], | ||||
|     "require": { | ||||
|         "php": "^7.1|^8", | ||||
|         "psr/log": "^1|^2|^3", | ||||
|         "symfony/var-dumper": "^2.6|^3|^4|^5|^6" | ||||
|     }, | ||||
|     "require-dev": { | ||||
|         "phpunit/phpunit": "^7.5.20 || ^9.4.2", | ||||
|         "twig/twig": "^1.38|^2.7|^3.0" | ||||
|     }, | ||||
|     "autoload": { | ||||
|         "psr-4": { | ||||
|             "DebugBar\\": "src/DebugBar/" | ||||
|         } | ||||
|     }, | ||||
|     "suggest": { | ||||
|         "kriswallsmith/assetic": "The best way to manage assets", | ||||
|         "monolog/monolog": "Log using Monolog", | ||||
|         "predis/predis": "Redis storage" | ||||
|     }, | ||||
|      "extra": { | ||||
|         "branch-alias": { | ||||
|             "dev-master": "1.18-dev" | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										75
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/CacheCacheCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/CacheCacheCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,75 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\Bridge; | ||||
|  | ||||
| use CacheCache\Cache; | ||||
| use CacheCache\LoggingBackend; | ||||
| use Monolog\Logger; | ||||
|  | ||||
| /** | ||||
|  * Collects CacheCache operations | ||||
|  * | ||||
|  * http://maximebf.github.io/CacheCache/ | ||||
|  * | ||||
|  * Example: | ||||
|  * <code> | ||||
|  * $debugbar->addCollector(new CacheCacheCollector(CacheManager::get('default'))); | ||||
|  * // or | ||||
|  * $debugbar->addCollector(new CacheCacheCollector()); | ||||
|  * $debugbar['cache']->addCache(CacheManager::get('default')); | ||||
|  * </code> | ||||
|  */ | ||||
| class CacheCacheCollector extends MonologCollector | ||||
| { | ||||
|     protected $logger; | ||||
|  | ||||
|     /** | ||||
|      * CacheCacheCollector constructor. | ||||
|      * @param Cache|null $cache | ||||
|      * @param Logger|null $logger | ||||
|      * @param bool $level | ||||
|      * @param bool $bubble | ||||
|      */ | ||||
|     public function __construct(Cache $cache = null, Logger $logger = null, $level = Logger::DEBUG, $bubble = true) | ||||
|     { | ||||
|         parent::__construct(null, $level, $bubble); | ||||
|  | ||||
|         if ($logger === null) { | ||||
|             $logger = new Logger('Cache'); | ||||
|         } | ||||
|         $this->logger = $logger; | ||||
|  | ||||
|         if ($cache !== null) { | ||||
|             $this->addCache($cache); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param Cache $cache | ||||
|      */ | ||||
|     public function addCache(Cache $cache) | ||||
|     { | ||||
|         $backend = $cache->getBackend(); | ||||
|         if (!($backend instanceof LoggingBackend)) { | ||||
|             $backend = new LoggingBackend($backend, $this->logger); | ||||
|         } | ||||
|         $cache->setBackend($backend); | ||||
|         $this->addLogger($backend->getLogger()); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getName() | ||||
|     { | ||||
|         return 'cache'; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										115
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/DoctrineCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										115
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/DoctrineCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,115 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\Bridge; | ||||
|  | ||||
| use DebugBar\DataCollector\AssetProvider; | ||||
| use DebugBar\DataCollector\DataCollector; | ||||
| use DebugBar\DataCollector\Renderable; | ||||
| use DebugBar\DebugBarException; | ||||
| use Doctrine\DBAL\Logging\DebugStack; | ||||
| use Doctrine\ORM\EntityManager; | ||||
|  | ||||
| /** | ||||
|  * Collects Doctrine queries | ||||
|  * | ||||
|  * http://doctrine-project.org | ||||
|  * | ||||
|  * Uses the DebugStack logger to collects data about queries | ||||
|  * | ||||
|  * <code> | ||||
|  * $debugStack = new Doctrine\DBAL\Logging\DebugStack(); | ||||
|  * $entityManager->getConnection()->getConfiguration()->setSQLLogger($debugStack); | ||||
|  * $debugbar->addCollector(new DoctrineCollector($debugStack)); | ||||
|  * </code> | ||||
|  */ | ||||
| class DoctrineCollector extends DataCollector implements Renderable, AssetProvider | ||||
| { | ||||
|     protected $debugStack; | ||||
|  | ||||
|     /** | ||||
|      * DoctrineCollector constructor. | ||||
|      * @param $debugStackOrEntityManager | ||||
|      * @throws DebugBarException | ||||
|      */ | ||||
|     public function __construct($debugStackOrEntityManager) | ||||
|     { | ||||
|         if ($debugStackOrEntityManager instanceof EntityManager) { | ||||
|             $debugStackOrEntityManager = $debugStackOrEntityManager->getConnection()->getConfiguration()->getSQLLogger(); | ||||
|         } | ||||
|         if (!($debugStackOrEntityManager instanceof DebugStack)) { | ||||
|             throw new DebugBarException("'DoctrineCollector' requires an 'EntityManager' or 'DebugStack' object"); | ||||
|         } | ||||
|         $this->debugStack = $debugStackOrEntityManager; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function collect() | ||||
|     { | ||||
|         $queries = array(); | ||||
|         $totalExecTime = 0; | ||||
|         foreach ($this->debugStack->queries as $q) { | ||||
|             $queries[] = array( | ||||
|                 'sql' => $q['sql'], | ||||
|                 'params' => (object) $q['params'], | ||||
|                 'duration' => $q['executionMS'], | ||||
|                 'duration_str' => $this->formatDuration($q['executionMS']) | ||||
|             ); | ||||
|             $totalExecTime += $q['executionMS']; | ||||
|         } | ||||
|  | ||||
|         return array( | ||||
|             'nb_statements' => count($queries), | ||||
|             'accumulated_duration' => $totalExecTime, | ||||
|             'accumulated_duration_str' => $this->formatDuration($totalExecTime), | ||||
|             'statements' => $queries | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getName() | ||||
|     { | ||||
|         return 'doctrine'; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getWidgets() | ||||
|     { | ||||
|         return array( | ||||
|             "database" => array( | ||||
|                 "icon" => "arrow-right", | ||||
|                 "widget" => "PhpDebugBar.Widgets.SQLQueriesWidget", | ||||
|                 "map" => "doctrine", | ||||
|                 "default" => "[]" | ||||
|             ), | ||||
|             "database:badge" => array( | ||||
|                 "map" => "doctrine.nb_statements", | ||||
|                 "default" => 0 | ||||
|             ) | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getAssets() | ||||
|     { | ||||
|         return array( | ||||
|             'css' => 'widgets/sqlqueries/widget.css', | ||||
|             'js' => 'widgets/sqlqueries/widget.js' | ||||
|         ); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										118
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/MonologCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										118
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/MonologCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,118 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\Bridge; | ||||
|  | ||||
| use DebugBar\DataCollector\DataCollectorInterface; | ||||
| use DebugBar\DataCollector\MessagesAggregateInterface; | ||||
| use DebugBar\DataCollector\Renderable; | ||||
| use Monolog\Handler\AbstractProcessingHandler; | ||||
| use Monolog\Logger; | ||||
|  | ||||
| /** | ||||
|  * A monolog handler as well as a data collector | ||||
|  * | ||||
|  * https://github.com/Seldaek/monolog | ||||
|  * | ||||
|  * <code> | ||||
|  * $debugbar->addCollector(new MonologCollector($logger)); | ||||
|  * </code> | ||||
|  */ | ||||
| class MonologCollector extends AbstractProcessingHandler implements DataCollectorInterface, Renderable, MessagesAggregateInterface | ||||
| { | ||||
|     protected $name; | ||||
|  | ||||
|     protected $records = array(); | ||||
|  | ||||
|     /** | ||||
|      * @param Logger $logger | ||||
|      * @param int $level | ||||
|      * @param boolean $bubble | ||||
|      * @param string $name | ||||
|      */ | ||||
|     public function __construct(Logger $logger = null, $level = Logger::DEBUG, $bubble = true, $name = 'monolog') | ||||
|     { | ||||
|         parent::__construct($level, $bubble); | ||||
|         $this->name = $name; | ||||
|         if ($logger !== null) { | ||||
|             $this->addLogger($logger); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Adds logger which messages you want to log | ||||
|      * | ||||
|      * @param Logger $logger | ||||
|      */ | ||||
|     public function addLogger(Logger $logger) | ||||
|     { | ||||
|         $logger->pushHandler($this); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param array $record | ||||
|      */ | ||||
|     protected function write(array $record): void | ||||
|     { | ||||
|         $this->records[] = array( | ||||
|             'message' => $record['formatted'], | ||||
|             'is_string' => true, | ||||
|             'label' => strtolower($record['level_name']), | ||||
|             'time' => $record['datetime']->format('U') | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getMessages() | ||||
|     { | ||||
|         return $this->records; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function collect() | ||||
|     { | ||||
|         return array( | ||||
|             'count' => count($this->records), | ||||
|             'records' => $this->records | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getName() | ||||
|     { | ||||
|         return $this->name; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getWidgets() | ||||
|     { | ||||
|         $name = $this->getName(); | ||||
|         return array( | ||||
|             $name => array( | ||||
|                 "icon" => "suitcase", | ||||
|                 "widget" => "PhpDebugBar.Widgets.MessagesWidget", | ||||
|                 "map" => "$name.records", | ||||
|                 "default" => "[]" | ||||
|             ), | ||||
|             "$name:badge" => array( | ||||
|                 "map" => "$name.count", | ||||
|                 "default" => "null" | ||||
|             ) | ||||
|         ); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										204
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/NamespacedTwigProfileCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										204
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/NamespacedTwigProfileCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,204 @@ | ||||
| <?php | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace DebugBar\Bridge; | ||||
|  | ||||
| use DebugBar\DataCollector\AssetProvider; | ||||
| use DebugBar\DataCollector\DataCollector; | ||||
| use DebugBar\DataCollector\Renderable; | ||||
| use Twig\Environment; | ||||
| use Twig\Loader\LoaderInterface; | ||||
| use Twig\Profiler\Dumper\HtmlDumper; | ||||
| use Twig\Profiler\Profile; | ||||
|  | ||||
| /** | ||||
|  * Collects data about rendered templates | ||||
|  * | ||||
|  * http://twig.sensiolabs.org/ | ||||
|  * | ||||
|  * A \Twig\Profiler\Profile should be added to your \Twig\Environment | ||||
|  * The root-Twig\Profiler\Profile-object should then be injected into this collector | ||||
|  * | ||||
|  * you can optionally provide the \Twig\Environment or the \Twig\Loader to also create | ||||
|  * debug-links. | ||||
|  * | ||||
|  * @see \Twig\Extension\ProfilerExtension, \Twig\Profiler\Profile | ||||
|  * | ||||
|  * <code> | ||||
|  * $env = new \Twig\Environment($loader); // Or from a PSR11-container | ||||
|  * $profile = new \Twig\Profiler\Profile(); | ||||
|  * $env->addExtension(new \Twig\Extension\ProfilerExtension($profile)); | ||||
|  * $debugbar->addCollector(new ModernTwigProfileCollector($profile, $env)); | ||||
|  * // or: $debugbar->addCollector(new ModernTwigProfileCollector($profile, $loader)); | ||||
|  * </code> | ||||
|  */ | ||||
| class NamespacedTwigProfileCollector extends DataCollector implements Renderable, AssetProvider | ||||
| { | ||||
|     /** | ||||
|      * @var Profile | ||||
|      */ | ||||
|     private $profile; | ||||
|  | ||||
|     /** | ||||
|      * @var LoaderInterface|Environment|null | ||||
|      */ | ||||
|     private $loader; | ||||
|  | ||||
|     /** | ||||
|      * @var int | ||||
|      */ | ||||
|     private $templateCount; | ||||
|  | ||||
|     /** | ||||
|      * @var int | ||||
|      */ | ||||
|     private $blockCount; | ||||
|  | ||||
|     /** | ||||
|      * @var int | ||||
|      */ | ||||
|     private $macroCount; | ||||
|     /** | ||||
|      * @var array[] { | ||||
|      * @var string $name | ||||
|      * @var int $render_time | ||||
|      * @var string $render_time_str | ||||
|      * @var string $memory_str | ||||
|      * @var string $xdebug_link | ||||
|      * } | ||||
|      */ | ||||
|     private $templates; | ||||
|  | ||||
|     /** | ||||
|      * TwigProfileCollector constructor. | ||||
|      * | ||||
|      * @param Profile $profile | ||||
|      * @param LoaderInterface|Environment $loaderOrEnv | ||||
|      */ | ||||
|     public function __construct(Profile $profile, $loaderOrEnv = null) | ||||
|     { | ||||
|         $this->profile = $profile; | ||||
|         if ($loaderOrEnv instanceof Environment) { | ||||
|             $loaderOrEnv = $loaderOrEnv->getLoader(); | ||||
|         } | ||||
|         $this->loader = $loaderOrEnv; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns a hash where keys are control names and their values | ||||
|      * an array of options as defined in {@see \DebugBar\JavascriptRenderer::addControl()} | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getWidgets() | ||||
|     { | ||||
|         return [ | ||||
|             'twig' => [ | ||||
|                 'icon' => 'leaf', | ||||
|                 'widget' => 'PhpDebugBar.Widgets.TemplatesWidget', | ||||
|                 'map' => 'twig', | ||||
|                 'default' => json_encode(['templates' => []]), | ||||
|             ], | ||||
|             'twig:badge' => [ | ||||
|                 'map' => 'twig.badge', | ||||
|                 'default' => 0, | ||||
|             ], | ||||
|         ]; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getAssets() | ||||
|     { | ||||
|         return [ | ||||
|             'css' => 'widgets/templates/widget.css', | ||||
|             'js' => 'widgets/templates/widget.js', | ||||
|         ]; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Called by the DebugBar when data needs to be collected | ||||
|      * | ||||
|      * @return array Collected data | ||||
|      */ | ||||
|     public function collect() | ||||
|     { | ||||
|         $this->templateCount = $this->blockCount = $this->macroCount = 0; | ||||
|         $this->templates = []; | ||||
|         $this->computeData($this->profile); | ||||
|  | ||||
|         return [ | ||||
|             'nb_templates' => $this->templateCount, | ||||
|             'nb_blocks' => $this->blockCount, | ||||
|             'nb_macros' => $this->macroCount, | ||||
|             'templates' => $this->templates, | ||||
|             'accumulated_render_time' => $this->profile->getDuration(), | ||||
|             'accumulated_render_time_str' => $this->getDataFormatter()->formatDuration($this->profile->getDuration()), | ||||
|             'memory_usage_str' => $this->getDataFormatter()->formatBytes($this->profile->getMemoryUsage()), | ||||
|             'callgraph' => $this->getHtmlCallGraph(), | ||||
|             'badge' => implode( | ||||
|                 '/', | ||||
|                 [ | ||||
|                     $this->templateCount, | ||||
|                     $this->blockCount, | ||||
|                     $this->macroCount, | ||||
|                 ] | ||||
|             ), | ||||
|         ]; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the unique name of the collector | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getName() | ||||
|     { | ||||
|         return 'twig'; | ||||
|     } | ||||
|  | ||||
|     public function getHtmlCallGraph() | ||||
|     { | ||||
|         $dumper = new HtmlDumper(); | ||||
|         return $dumper->dump($this->profile); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get an Xdebug Link to a file | ||||
|      * | ||||
|      * @return array { | ||||
|      * @var string url | ||||
|      * @var bool ajax | ||||
|      * } | ||||
|      */ | ||||
|     public function getXdebugLink($template, $line = 1) | ||||
|     { | ||||
|         if (is_null($this->loader)) { | ||||
|             return null; | ||||
|         } | ||||
|         $file = $this->loader->getSourceContext($template)->getPath(); | ||||
|  | ||||
|         return parent::getXdebugLink($file, $line); | ||||
|     } | ||||
|  | ||||
|     private function computeData(Profile $profile) | ||||
|     { | ||||
|         $this->templateCount += ($profile->isTemplate() ? 1 : 0); | ||||
|         $this->blockCount += ($profile->isBlock() ? 1 : 0); | ||||
|         $this->macroCount += ($profile->isMacro() ? 1 : 0); | ||||
|         if ($profile->isTemplate()) { | ||||
|             $this->templates[] = [ | ||||
|                 'name' => $profile->getName(), | ||||
|                 'render_time' => $profile->getDuration(), | ||||
|                 'render_time_str' => $this->getDataFormatter()->formatDuration($profile->getDuration()), | ||||
|                 'memory_str' => $this->getDataFormatter()->formatBytes($profile->getMemoryUsage()), | ||||
|                 'xdebug_link' => $this->getXdebugLink($profile->getTemplate()), | ||||
|             ]; | ||||
|         } | ||||
|         foreach ($profile as $p) { | ||||
|             $this->computeData($p); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										307
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/Propel2Collector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										307
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/Propel2Collector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,307 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\Bridge; | ||||
|  | ||||
| use DebugBar\DataCollector\AssetProvider; | ||||
| use DebugBar\DataCollector\DataCollector; | ||||
| use DebugBar\DataCollector\Renderable; | ||||
| use Monolog\Handler\TestHandler; | ||||
| use Monolog\Logger; | ||||
| use Propel\Runtime\Connection\ConnectionInterface; | ||||
| use Propel\Runtime\Connection\ProfilerConnectionWrapper; | ||||
| use Propel\Runtime\Propel; | ||||
| use Psr\Log\LogLevel; | ||||
| use Psr\Log\LoggerInterface; | ||||
|  | ||||
| /** | ||||
|  * A Propel logger which acts as a data collector | ||||
|  * | ||||
|  * http://propelorm.org/ | ||||
|  * | ||||
|  * Will log queries and display them using the SQLQueries widget. | ||||
|  * | ||||
|  * Example: | ||||
|  * <code> | ||||
|  * $debugbar->addCollector(new \DebugBar\Bridge\Propel2Collector(\Propel\Runtime\Propel::getServiceContainer()->getReadConnection())); | ||||
|  * </code> | ||||
|  */ | ||||
| class Propel2Collector extends DataCollector implements Renderable, AssetProvider | ||||
| { | ||||
|     /** | ||||
|      * @var null|TestHandler | ||||
|      */ | ||||
|     protected $handler = null; | ||||
|  | ||||
|     /** | ||||
|      * @var null|Logger | ||||
|      */ | ||||
|     protected $logger = null; | ||||
|  | ||||
|     /** | ||||
|      * @var array | ||||
|      */ | ||||
|     protected $config = array(); | ||||
|  | ||||
|     /** | ||||
|      * @var array | ||||
|      */ | ||||
|     protected $errors = array(); | ||||
|  | ||||
|     /** | ||||
|      * @var int | ||||
|      */ | ||||
|     protected $queryCount = 0; | ||||
|  | ||||
|     /** | ||||
|      * @param ConnectionInterface $connection Propel connection | ||||
|      */ | ||||
|     public function __construct( | ||||
|         ConnectionInterface $connection, | ||||
|         array $logMethods = array( | ||||
|             'beginTransaction', | ||||
|             'commit', | ||||
|             'rollBack', | ||||
|             'forceRollBack', | ||||
|             'exec', | ||||
|             'query', | ||||
|             'execute' | ||||
|         ) | ||||
|     ) { | ||||
|         if ($connection instanceof ProfilerConnectionWrapper) { | ||||
|             $connection->setLogMethods($logMethods); | ||||
|  | ||||
|             $this->config = $connection->getProfiler()->getConfiguration(); | ||||
|  | ||||
|             $this->handler = new TestHandler(); | ||||
|  | ||||
|             if ($connection->getLogger() instanceof Logger) { | ||||
|                 $this->logger = $connection->getLogger(); | ||||
|                 $this->logger->pushHandler($this->handler); | ||||
|             } else { | ||||
|                 $this->errors[] = 'Supported only monolog logger'; | ||||
|             } | ||||
|         } else { | ||||
|             $this->errors[] = 'You need set ProfilerConnectionWrapper'; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return TestHandler|null | ||||
|      */ | ||||
|     public function getHandler() | ||||
|     { | ||||
|         return $this->handler; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getConfig() | ||||
|     { | ||||
|         return $this->config; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return Logger|null | ||||
|      */ | ||||
|     public function getLogger() | ||||
|     { | ||||
|         return $this->logger; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return LoggerInterface | ||||
|      */ | ||||
|     protected function getDefaultLogger() | ||||
|     { | ||||
|         return Propel::getServiceContainer()->getLogger(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return int | ||||
|      */ | ||||
|     protected function getQueryCount() | ||||
|     { | ||||
|         return $this->queryCount; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param array $records | ||||
|      * @param array $config | ||||
|      * @return array | ||||
|      */ | ||||
|     protected function getStatements($records, $config) | ||||
|     { | ||||
|         $statements = array(); | ||||
|         foreach ($records as $record) { | ||||
|             $duration = null; | ||||
|             $memory = null; | ||||
|  | ||||
|             $isSuccess = ( LogLevel::INFO === strtolower($record['level_name']) ); | ||||
|  | ||||
|             $detailsCount = count($config['details']); | ||||
|             $parameters = explode($config['outerGlue'], $record['message'], $detailsCount + 1); | ||||
|             if (count($parameters) === ($detailsCount + 1)) { | ||||
|                 $parameters = array_map('trim', $parameters); | ||||
|                 $_details = array(); | ||||
|                 foreach (array_splice($parameters, 0, $detailsCount) as $string) { | ||||
|                     list($key, $value) = array_map('trim', explode($config['innerGlue'], $string, 2)); | ||||
|                     $_details[$key] = $value; | ||||
|                 } | ||||
|  | ||||
|                 $details = array(); | ||||
|                 foreach ($config['details'] as $key => $detail) { | ||||
|                     if (isset($_details[$detail['name']])) { | ||||
|                         $value = $_details[$detail['name']]; | ||||
|                         if ('time' === $key) { | ||||
|                             if (substr_count($value, 'ms')) { | ||||
|                                 $value = (float)$value / 1000; | ||||
|                             } else { | ||||
|                                 $value = (float)$value; | ||||
|                             } | ||||
|                         } else { | ||||
|                             $suffixes = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); | ||||
|                             $suffix = substr($value, -2); | ||||
|                             $i = array_search($suffix, $suffixes, true); | ||||
|                             $i = (false === $i) ? 0 : $i; | ||||
|  | ||||
|                             $value = ((float)$value) * pow(1024, $i); | ||||
|                         } | ||||
|                         $details[$key] = $value; | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                 if (isset($details['time'])) { | ||||
|                     $duration = $details['time']; | ||||
|                 } | ||||
|                 if (isset($details['memDelta'])) { | ||||
|                     $memory = $details['memDelta']; | ||||
|                 } | ||||
|  | ||||
|                 $message = end($parameters); | ||||
|  | ||||
|                 if ($isSuccess) { | ||||
|                     $this->queryCount++; | ||||
|                 } | ||||
|  | ||||
|             } else { | ||||
|                 $message = $record['message']; | ||||
|             } | ||||
|  | ||||
|             $statement = array( | ||||
|                 'sql' => $message, | ||||
|                 'is_success' => $isSuccess, | ||||
|                 'duration' => $duration, | ||||
|                 'duration_str' => $this->getDataFormatter()->formatDuration($duration), | ||||
|                 'memory' => $memory, | ||||
|                 'memory_str' => $this->getDataFormatter()->formatBytes($memory), | ||||
|             ); | ||||
|  | ||||
|             if (false === $isSuccess) { | ||||
|                 $statement['sql'] = ''; | ||||
|                 $statement['error_code'] = $record['level']; | ||||
|                 $statement['error_message'] = $message; | ||||
|             } | ||||
|  | ||||
|             $statements[] = $statement; | ||||
|         } | ||||
|         return $statements; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function collect() | ||||
|     { | ||||
|         if (count($this->errors)) { | ||||
|             return array( | ||||
|                 'statements' => array_map(function ($message) { | ||||
|                     return array('sql' => '', 'is_success' => false, 'error_code' => 500, 'error_message' => $message); | ||||
|                 }, $this->errors), | ||||
|                 'nb_statements' => 0, | ||||
|                 'nb_failed_statements' => count($this->errors), | ||||
|             ); | ||||
|         } | ||||
|  | ||||
|         if ($this->getHandler() === null) { | ||||
|             return array(); | ||||
|         } | ||||
|  | ||||
|         $statements = $this->getStatements($this->getHandler()->getRecords(), $this->getConfig()); | ||||
|  | ||||
|         $failedStatement = count(array_filter($statements, function ($statement) { | ||||
|             return false === $statement['is_success']; | ||||
|         })); | ||||
|         $accumulatedDuration = array_reduce($statements, function ($accumulatedDuration, $statement) { | ||||
|          | ||||
|             $time = isset($statement['duration']) ? $statement['duration'] : 0; | ||||
|             return $accumulatedDuration += $time; | ||||
|         }); | ||||
|         $memoryUsage = array_reduce($statements, function ($memoryUsage, $statement) { | ||||
|          | ||||
|             $time = isset($statement['memory']) ? $statement['memory'] : 0; | ||||
|             return $memoryUsage += $time; | ||||
|         }); | ||||
|  | ||||
|         return array( | ||||
|             'nb_statements' => $this->getQueryCount(), | ||||
|             'nb_failed_statements' => $failedStatement, | ||||
|             'accumulated_duration' => $accumulatedDuration, | ||||
|             'accumulated_duration_str' => $this->getDataFormatter()->formatDuration($accumulatedDuration), | ||||
|             'memory_usage' => $memoryUsage, | ||||
|             'memory_usage_str' => $this->getDataFormatter()->formatBytes($memoryUsage), | ||||
|             'statements' => $statements | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getName() | ||||
|     { | ||||
|         $additionalName  = ''; | ||||
|         if ($this->getLogger() !== $this->getDefaultLogger()) { | ||||
|             $additionalName = ' ('.$this->getLogger()->getName().')'; | ||||
|         } | ||||
|  | ||||
|         return 'propel2'.$additionalName; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getWidgets() | ||||
|     { | ||||
|         return array( | ||||
|             $this->getName() => array( | ||||
|                 'icon' => 'bolt', | ||||
|                 'widget' => 'PhpDebugBar.Widgets.SQLQueriesWidget', | ||||
|                 'map' => $this->getName(), | ||||
|                 'default' => '[]' | ||||
|             ), | ||||
|             $this->getName().':badge' => array( | ||||
|                 'map' => $this->getName().'.nb_statements', | ||||
|                 'default' => 0 | ||||
|             ), | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getAssets() | ||||
|     { | ||||
|         return array( | ||||
|             'css' => 'widgets/sqlqueries/widget.css', | ||||
|             'js' => 'widgets/sqlqueries/widget.js' | ||||
|         ); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										253
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/PropelCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										253
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/PropelCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,253 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\Bridge; | ||||
|  | ||||
| use BasicLogger; | ||||
| use DebugBar\DataCollector\AssetProvider; | ||||
| use DebugBar\DataCollector\DataCollector; | ||||
| use DebugBar\DataCollector\Renderable; | ||||
| use Propel; | ||||
| use PropelConfiguration; | ||||
| use PropelPDO; | ||||
| use Psr\Log\LogLevel; | ||||
| use Psr\Log\LoggerInterface; | ||||
|  | ||||
| /** | ||||
|  * A Propel logger which acts as a data collector | ||||
|  * | ||||
|  * http://propelorm.org/ | ||||
|  * | ||||
|  * Will log queries and display them using the SQLQueries widget. | ||||
|  * You can provide a LoggerInterface object to forward non-query related message to. | ||||
|  * | ||||
|  * Example: | ||||
|  * <code> | ||||
|  * $debugbar->addCollector(new PropelCollector($debugbar['messages'])); | ||||
|  * PropelCollector::enablePropelProfiling(); | ||||
|  * </code> | ||||
|  */ | ||||
| class PropelCollector extends DataCollector implements BasicLogger, Renderable, AssetProvider | ||||
| { | ||||
|     protected $logger; | ||||
|  | ||||
|     protected $statements = array(); | ||||
|  | ||||
|     protected $accumulatedTime = 0; | ||||
|  | ||||
|     protected $peakMemory = 0; | ||||
|  | ||||
|     /** | ||||
|      * Sets the needed configuration option in propel to enable query logging | ||||
|      * | ||||
|      * @param PropelConfiguration $config Apply profiling on a specific config | ||||
|      */ | ||||
|     public static function enablePropelProfiling(PropelConfiguration $config = null) | ||||
|     { | ||||
|         if ($config === null) { | ||||
|             $config = Propel::getConfiguration(PropelConfiguration::TYPE_OBJECT); | ||||
|         } | ||||
|         $config->setParameter('debugpdo.logging.details.method.enabled', true); | ||||
|         $config->setParameter('debugpdo.logging.details.time.enabled', true); | ||||
|         $config->setParameter('debugpdo.logging.details.mem.enabled', true); | ||||
|         $allMethods = array( | ||||
|             'PropelPDO::__construct',       // logs connection opening | ||||
|             'PropelPDO::__destruct',        // logs connection close | ||||
|             'PropelPDO::exec',              // logs a query | ||||
|             'PropelPDO::query',             // logs a query | ||||
|             'PropelPDO::beginTransaction',  // logs a transaction begin | ||||
|             'PropelPDO::commit',            // logs a transaction commit | ||||
|             'PropelPDO::rollBack',          // logs a transaction rollBack (watch out for the capital 'B') | ||||
|             'DebugPDOStatement::execute',   // logs a query from a prepared statement | ||||
|         ); | ||||
|         $config->setParameter('debugpdo.logging.methods', $allMethods, false); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param LoggerInterface $logger A logger to forward non-query log lines to | ||||
|      * @param PropelPDO $conn Bound this collector to a connection only | ||||
|      */ | ||||
|     public function __construct(LoggerInterface $logger = null, PropelPDO $conn = null) | ||||
|     { | ||||
|         if ($conn) { | ||||
|             $conn->setLogger($this); | ||||
|         } else { | ||||
|             Propel::setLogger($this); | ||||
|         } | ||||
|         $this->logger = $logger; | ||||
|         $this->logQueriesToLogger = false; | ||||
|     } | ||||
|  | ||||
|     public function setLogQueriesToLogger($enable = true) | ||||
|     { | ||||
|         $this->logQueriesToLogger = $enable; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function isLogQueriesToLogger() | ||||
|     { | ||||
|         return $this->logQueriesToLogger; | ||||
|     } | ||||
|  | ||||
|     public function emergency($m) | ||||
|     { | ||||
|         $this->log($m, Propel::LOG_EMERG); | ||||
|     } | ||||
|  | ||||
|     public function alert($m) | ||||
|     { | ||||
|         $this->log($m, Propel::LOG_ALERT); | ||||
|     } | ||||
|  | ||||
|     public function crit($m) | ||||
|     { | ||||
|         $this->log($m, Propel::LOG_CRIT); | ||||
|     } | ||||
|  | ||||
|     public function err($m) | ||||
|     { | ||||
|         $this->log($m, Propel::LOG_ERR); | ||||
|     } | ||||
|  | ||||
|     public function warning($m) | ||||
|     { | ||||
|         $this->log($m, Propel::LOG_WARNING); | ||||
|     } | ||||
|  | ||||
|     public function notice($m) | ||||
|     { | ||||
|         $this->log($m, Propel::LOG_NOTICE); | ||||
|     } | ||||
|  | ||||
|     public function info($m) | ||||
|     { | ||||
|         $this->log($m, Propel::LOG_INFO); | ||||
|     } | ||||
|  | ||||
|     public function debug($m) | ||||
|     { | ||||
|         $this->log($m, Propel::LOG_DEBUG); | ||||
|     } | ||||
|  | ||||
|     public function log($message, $severity = null) | ||||
|     { | ||||
|         if (strpos($message, 'DebugPDOStatement::execute') !== false) { | ||||
|             list($sql, $duration_str) = $this->parseAndLogSqlQuery($message); | ||||
|             if (!$this->logQueriesToLogger) { | ||||
|                 return; | ||||
|             } | ||||
|             $message = "$sql ($duration_str)"; | ||||
|         } | ||||
|  | ||||
|         if ($this->logger !== null) { | ||||
|             $this->logger->log($this->convertLogLevel($severity), $message); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Converts Propel log levels to PSR log levels | ||||
|      * | ||||
|      * @param int $level | ||||
|      * @return string | ||||
|      */ | ||||
|     protected function convertLogLevel($level) | ||||
|     { | ||||
|         $map = array( | ||||
|             Propel::LOG_EMERG => LogLevel::EMERGENCY, | ||||
|             Propel::LOG_ALERT => LogLevel::ALERT, | ||||
|             Propel::LOG_CRIT => LogLevel::CRITICAL, | ||||
|             Propel::LOG_ERR => LogLevel::ERROR, | ||||
|             Propel::LOG_WARNING => LogLevel::WARNING, | ||||
|             Propel::LOG_NOTICE => LogLevel::NOTICE, | ||||
|             Propel::LOG_DEBUG => LogLevel::DEBUG | ||||
|         ); | ||||
|         return $map[$level]; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Parse a log line to extract query information | ||||
|      * | ||||
|      * @param string $message | ||||
|      */ | ||||
|     protected function parseAndLogSqlQuery($message) | ||||
|     { | ||||
|         $parts = explode('|', $message, 4); | ||||
|         $sql = trim($parts[3]); | ||||
|  | ||||
|         $duration = 0; | ||||
|         if (preg_match('/([0-9]+\.[0-9]+)/', $parts[1], $matches)) { | ||||
|             $duration = (float) $matches[1]; | ||||
|         } | ||||
|  | ||||
|         $memory = 0; | ||||
|         if (preg_match('/([0-9]+\.[0-9]+) ([A-Z]{1,2})/', $parts[2], $matches)) { | ||||
|             $memory = (float) $matches[1]; | ||||
|             if ($matches[2] == 'KB') { | ||||
|                 $memory *= 1024; | ||||
|             } elseif ($matches[2] == 'MB') { | ||||
|                 $memory *= 1024 * 1024; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         $this->statements[] = array( | ||||
|             'sql' => $sql, | ||||
|             'is_success' => true, | ||||
|             'duration' => $duration, | ||||
|             'duration_str' => $this->formatDuration($duration), | ||||
|             'memory' => $memory, | ||||
|             'memory_str' => $this->formatBytes($memory) | ||||
|         ); | ||||
|         $this->accumulatedTime += $duration; | ||||
|         $this->peakMemory = max($this->peakMemory, $memory); | ||||
|         return array($sql, $this->formatDuration($duration)); | ||||
|     } | ||||
|  | ||||
|     public function collect() | ||||
|     { | ||||
|         return array( | ||||
|             'nb_statements' => count($this->statements), | ||||
|             'nb_failed_statements' => 0, | ||||
|             'accumulated_duration' => $this->accumulatedTime, | ||||
|             'accumulated_duration_str' => $this->formatDuration($this->accumulatedTime), | ||||
|             'peak_memory_usage' => $this->peakMemory, | ||||
|             'peak_memory_usage_str' => $this->formatBytes($this->peakMemory), | ||||
|             'statements' => $this->statements | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     public function getName() | ||||
|     { | ||||
|         return 'propel'; | ||||
|     } | ||||
|  | ||||
|     public function getWidgets() | ||||
|     { | ||||
|         return array( | ||||
|             "propel" => array( | ||||
|                 "icon" => "bolt", | ||||
|                 "widget" => "PhpDebugBar.Widgets.SQLQueriesWidget", | ||||
|                 "map" => "propel", | ||||
|                 "default" => "[]" | ||||
|             ), | ||||
|             "propel:badge" => array( | ||||
|                 "map" => "propel.nb_statements", | ||||
|                 "default" => 0 | ||||
|             ) | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     public function getAssets() | ||||
|     { | ||||
|         return array( | ||||
|             'css' => 'widgets/sqlqueries/widget.css', | ||||
|             'js' => 'widgets/sqlqueries/widget.js' | ||||
|         ); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										66
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/SlimCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/SlimCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,66 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\Bridge; | ||||
|  | ||||
| use DebugBar\DataCollector\MessagesCollector; | ||||
| use Psr\Log\LogLevel; | ||||
| use Slim\Log; | ||||
| use Slim\Slim; | ||||
|  | ||||
| /** | ||||
|  * Collects messages from a Slim logger | ||||
|  * | ||||
|  * http://slimframework.com | ||||
|  */ | ||||
| class SlimCollector extends MessagesCollector | ||||
| { | ||||
|     protected $slim; | ||||
|  | ||||
|     protected $originalLogWriter; | ||||
|  | ||||
|     public function __construct(Slim $slim) | ||||
|     { | ||||
|         $this->slim = $slim; | ||||
|         if ($log = $slim->getLog()) { | ||||
|             $this->originalLogWriter = $log->getWriter(); | ||||
|             $log->setWriter($this); | ||||
|             $log->setEnabled(true); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public function write($message, $level) | ||||
|     { | ||||
|         if ($this->originalLogWriter) { | ||||
|             $this->originalLogWriter->write($message, $level); | ||||
|         } | ||||
|         $this->addMessage($message, $this->getLevelName($level)); | ||||
|     } | ||||
|  | ||||
|     protected function getLevelName($level) | ||||
|     { | ||||
|         $map = array( | ||||
|             Log::EMERGENCY => LogLevel::EMERGENCY, | ||||
|             Log::ALERT => LogLevel::ALERT, | ||||
|             Log::CRITICAL => LogLevel::CRITICAL, | ||||
|             Log::ERROR => LogLevel::ERROR, | ||||
|             Log::WARN => LogLevel::WARNING, | ||||
|             Log::NOTICE => LogLevel::NOTICE, | ||||
|             Log::INFO => LogLevel::INFO, | ||||
|             Log::DEBUG => LogLevel::DEBUG | ||||
|         ); | ||||
|         return $map[$level]; | ||||
|     } | ||||
|  | ||||
|     public function getName() | ||||
|     { | ||||
|         return 'slim'; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										53
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/SwiftMailer/SwiftLogCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/SwiftMailer/SwiftLogCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,53 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\Bridge\SwiftMailer; | ||||
|  | ||||
| use DebugBar\DataCollector\MessagesCollector; | ||||
| use Swift_Mailer; | ||||
| use Swift_Plugins_Logger; | ||||
| use Swift_Plugins_LoggerPlugin; | ||||
|  | ||||
| /** | ||||
|  * Collects log messages | ||||
|  * | ||||
|  * http://swiftmailer.org/ | ||||
|  */ | ||||
| class SwiftLogCollector extends MessagesCollector implements Swift_Plugins_Logger | ||||
| { | ||||
|     public function __construct(Swift_Mailer $mailer) | ||||
|     { | ||||
|         $mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($this)); | ||||
|     } | ||||
|  | ||||
|     public function add($entry) | ||||
|     { | ||||
|         $this->addMessage($entry); | ||||
|     } | ||||
|  | ||||
|     public function dump() | ||||
|     { | ||||
|         $dump = ''; | ||||
|         foreach ($this->messages as $message) { | ||||
|             if (!$message['is_string']) { | ||||
|                 continue; | ||||
|             } | ||||
|  | ||||
|             $dump .= $message['message'] . PHP_EOL; | ||||
|         } | ||||
|  | ||||
|         return $dump; | ||||
|     } | ||||
|  | ||||
|     public function getName() | ||||
|     { | ||||
|         return 'swiftmailer_logs'; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										92
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/SwiftMailer/SwiftMailCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/SwiftMailer/SwiftMailCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,92 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\Bridge\SwiftMailer; | ||||
|  | ||||
| use DebugBar\DataCollector\AssetProvider; | ||||
| use DebugBar\DataCollector\DataCollector; | ||||
| use DebugBar\DataCollector\Renderable; | ||||
| use Swift_Mailer; | ||||
| use Swift_Plugins_MessageLogger; | ||||
|  | ||||
| /** | ||||
|  * Collects data about sent mails | ||||
|  * | ||||
|  * http://swiftmailer.org/ | ||||
|  */ | ||||
| class SwiftMailCollector extends DataCollector implements Renderable, AssetProvider | ||||
| { | ||||
|     protected $messagesLogger; | ||||
|  | ||||
|     public function __construct(Swift_Mailer $mailer) | ||||
|     { | ||||
|         $this->messagesLogger = new Swift_Plugins_MessageLogger(); | ||||
|         $mailer->registerPlugin($this->messagesLogger); | ||||
|     } | ||||
|  | ||||
|     public function collect() | ||||
|     { | ||||
|         $mails = array(); | ||||
|         foreach ($this->messagesLogger->getMessages() as $msg) { | ||||
|             $mails[] = array( | ||||
|                 'to' => $this->formatTo($msg->getTo()), | ||||
|                 'subject' => $msg->getSubject(), | ||||
|                 'headers' => $msg->getHeaders()->toString() | ||||
|             ); | ||||
|         } | ||||
|         return array( | ||||
|             'count' => count($mails), | ||||
|             'mails' => $mails | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     protected function formatTo($to) | ||||
|     { | ||||
|         if (!$to) { | ||||
|             return ''; | ||||
|         } | ||||
|  | ||||
|         $f = array(); | ||||
|         foreach ($to as $k => $v) { | ||||
|             $f[] = (empty($v) ? '' : "$v ") . "<$k>"; | ||||
|         } | ||||
|         return implode(', ', $f); | ||||
|     } | ||||
|  | ||||
|     public function getName() | ||||
|     { | ||||
|         return 'swiftmailer_mails'; | ||||
|     } | ||||
|  | ||||
|     public function getWidgets() | ||||
|     { | ||||
|         return array( | ||||
|             'emails' => array( | ||||
|                 'icon' => 'inbox', | ||||
|                 'widget' => 'PhpDebugBar.Widgets.MailsWidget', | ||||
|                 'map' => 'swiftmailer_mails.mails', | ||||
|                 'default' => '[]', | ||||
|                 'title' => 'Mails' | ||||
|             ), | ||||
|             'emails:badge' => array( | ||||
|                 'map' => 'swiftmailer_mails.count', | ||||
|                 'default' => 'null' | ||||
|             ) | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     public function getAssets() | ||||
|     { | ||||
|         return array( | ||||
|             'css' => 'widgets/mails/widget.css', | ||||
|             'js' => 'widgets/mails/widget.js' | ||||
|         ); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										60
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/Twig/TimeableTwigExtensionProfiler.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/Twig/TimeableTwigExtensionProfiler.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,60 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2017 Tim Riemenschneider | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\Bridge\Twig; | ||||
|  | ||||
| use DebugBar\DataCollector\TimeDataCollector; | ||||
| use Twig_Profiler_Profile; | ||||
|  | ||||
| /** | ||||
|  * Class TimeableTwigExtensionProfiler | ||||
|  * | ||||
|  * Extends Twig_Extension_Profiler to add rendering times to the TimeDataCollector | ||||
|  * | ||||
|  * @package DebugBar\Bridge\Twig | ||||
|  */ | ||||
| class TimeableTwigExtensionProfiler extends \Twig_Extension_Profiler | ||||
| { | ||||
|     /** | ||||
|      * @var \DebugBar\DataCollector\TimeDataCollector | ||||
|      */ | ||||
|     private $timeDataCollector; | ||||
|  | ||||
|     /** | ||||
|      * @param \DebugBar\DataCollector\TimeDataCollector $timeDataCollector | ||||
|      */ | ||||
|     public function setTimeDataCollector(TimeDataCollector $timeDataCollector) | ||||
|     { | ||||
|         $this->timeDataCollector = $timeDataCollector; | ||||
|     } | ||||
|  | ||||
|     public function __construct(\Twig_Profiler_Profile $profile, TimeDataCollector $timeDataCollector = null) | ||||
|     { | ||||
|         parent::__construct($profile); | ||||
|  | ||||
|         $this->timeDataCollector = $timeDataCollector; | ||||
|     } | ||||
|  | ||||
|     public function enter(Twig_Profiler_Profile $profile) | ||||
|     { | ||||
|         if ($this->timeDataCollector && $profile->isTemplate()) { | ||||
|             $this->timeDataCollector->startMeasure($profile->getName(), 'template ' . $profile->getName()); | ||||
|         } | ||||
|         parent::enter($profile); | ||||
|     } | ||||
|  | ||||
|     public function leave(Twig_Profiler_Profile $profile) | ||||
|     { | ||||
|         parent::leave($profile); | ||||
|         if ($this->timeDataCollector && $profile->isTemplate()) { | ||||
|             $this->timeDataCollector->stopMeasure($profile->getName()); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										419
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/Twig/TraceableTwigEnvironment.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										419
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/Twig/TraceableTwigEnvironment.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,419 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\Bridge\Twig; | ||||
|  | ||||
| use DebugBar\DataCollector\TimeDataCollector; | ||||
| use Twig_CompilerInterface; | ||||
| use Twig_Environment; | ||||
| use Twig_ExtensionInterface; | ||||
| use Twig_LexerInterface; | ||||
| use Twig_LoaderInterface; | ||||
| use Twig_NodeInterface; | ||||
| use Twig_NodeVisitorInterface; | ||||
| use Twig_ParserInterface; | ||||
| use Twig_TokenParserInterface; | ||||
| use Twig_TokenStream; | ||||
|  | ||||
| /** | ||||
|  * Wrapped a Twig Environment to provide profiling features | ||||
|  *  | ||||
|  * @deprecated | ||||
|  */ | ||||
| class TraceableTwigEnvironment extends Twig_Environment | ||||
| { | ||||
|     protected $twig; | ||||
|  | ||||
|     protected $renderedTemplates = array(); | ||||
|  | ||||
|     protected $timeDataCollector; | ||||
|  | ||||
|     /** | ||||
|      * @param Twig_Environment $twig | ||||
|      * @param TimeDataCollector $timeDataCollector | ||||
|      */ | ||||
|     public function __construct(Twig_Environment $twig, TimeDataCollector $timeDataCollector = null) | ||||
|     { | ||||
|         $this->twig = $twig; | ||||
|         $this->timeDataCollector = $timeDataCollector; | ||||
|     } | ||||
|  | ||||
|     public function __call($name, $arguments) | ||||
|     { | ||||
|         return call_user_func_array(array($this->twig, $name), $arguments); | ||||
|     } | ||||
|  | ||||
|     public function getRenderedTemplates() | ||||
|     { | ||||
|         return $this->renderedTemplates; | ||||
|     } | ||||
|  | ||||
|     public function addRenderedTemplate(array $info) | ||||
|     { | ||||
|         $this->renderedTemplates[] = $info; | ||||
|     } | ||||
|  | ||||
|     public function getTimeDataCollector() | ||||
|     { | ||||
|         return $this->timeDataCollector; | ||||
|     } | ||||
|  | ||||
|     public function getBaseTemplateClass() | ||||
|     { | ||||
|         return $this->twig->getBaseTemplateClass(); | ||||
|     } | ||||
|  | ||||
|     public function setBaseTemplateClass($class) | ||||
|     { | ||||
|         $this->twig->setBaseTemplateClass($class); | ||||
|     } | ||||
|  | ||||
|     public function enableDebug() | ||||
|     { | ||||
|         $this->twig->enableDebug(); | ||||
|     } | ||||
|  | ||||
|     public function disableDebug() | ||||
|     { | ||||
|         $this->twig->disableDebug(); | ||||
|     } | ||||
|  | ||||
|     public function isDebug() | ||||
|     { | ||||
|         return $this->twig->isDebug(); | ||||
|     } | ||||
|  | ||||
|     public function enableAutoReload() | ||||
|     { | ||||
|         $this->twig->enableAutoReload(); | ||||
|     } | ||||
|  | ||||
|     public function disableAutoReload() | ||||
|     { | ||||
|         $this->twig->disableAutoReload(); | ||||
|     } | ||||
|  | ||||
|     public function isAutoReload() | ||||
|     { | ||||
|         return $this->twig->isAutoReload(); | ||||
|     } | ||||
|  | ||||
|     public function enableStrictVariables() | ||||
|     { | ||||
|         $this->twig->enableStrictVariables(); | ||||
|     } | ||||
|  | ||||
|     public function disableStrictVariables() | ||||
|     { | ||||
|         $this->twig->disableStrictVariables(); | ||||
|     } | ||||
|  | ||||
|     public function isStrictVariables() | ||||
|     { | ||||
|         return $this->twig->isStrictVariables(); | ||||
|     } | ||||
|  | ||||
|     public function getCache($original = true) | ||||
|     { | ||||
|         return $this->twig->getCache($original); | ||||
|     } | ||||
|  | ||||
|     public function setCache($cache) | ||||
|     { | ||||
|         $this->twig->setCache($cache); | ||||
|     } | ||||
|  | ||||
|     public function getCacheFilename($name) | ||||
|     { | ||||
|         return $this->twig->getCacheFilename($name); | ||||
|     } | ||||
|  | ||||
|     public function getTemplateClass($name, $index = null) | ||||
|     { | ||||
|         return $this->twig->getTemplateClass($name, $index); | ||||
|     } | ||||
|  | ||||
|     public function getTemplateClassPrefix() | ||||
|     { | ||||
|         return $this->twig->getTemplateClassPrefix(); | ||||
|     } | ||||
|  | ||||
|     public function render($name, array $context = array()) | ||||
|     { | ||||
|         return $this->loadTemplate($name)->render($context); | ||||
|     } | ||||
|  | ||||
|     public function display($name, array $context = array()) | ||||
|     { | ||||
|         $this->loadTemplate($name)->display($context); | ||||
|     } | ||||
|  | ||||
|     public function loadTemplate($name, $index = null) | ||||
|     { | ||||
|         $cls = $this->twig->getTemplateClass($name, $index); | ||||
|  | ||||
|         if (isset($this->twig->loadedTemplates[$cls])) { | ||||
|             return $this->twig->loadedTemplates[$cls]; | ||||
|         } | ||||
|  | ||||
|         if (!class_exists($cls, false)) { | ||||
|             if (false === $cache = $this->getCacheFilename($name)) { | ||||
|                 eval('?>'.$this->compileSource($this->getLoader()->getSource($name), $name)); | ||||
|             } else { | ||||
|                 if (!is_file($cache) || ($this->isAutoReload() && !$this->isTemplateFresh($name, filemtime($cache)))) { | ||||
|                     $this->writeCacheFile($cache, $this->compileSource($this->getLoader()->getSource($name), $name)); | ||||
|                 } | ||||
|  | ||||
|                 require_once $cache; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if (!$this->twig->runtimeInitialized) { | ||||
|             $this->initRuntime(); | ||||
|         } | ||||
|  | ||||
|         return $this->twig->loadedTemplates[$cls] = new TraceableTwigTemplate($this, new $cls($this)); | ||||
|     } | ||||
|  | ||||
|     public function isTemplateFresh($name, $time) | ||||
|     { | ||||
|         return $this->twig->isTemplateFresh($name, $time); | ||||
|     } | ||||
|  | ||||
|     public function resolveTemplate($names) | ||||
|     { | ||||
|         return $this->twig->resolveTemplate($names); | ||||
|     } | ||||
|  | ||||
|     public function clearTemplateCache() | ||||
|     { | ||||
|         $this->twig->clearTemplateCache(); | ||||
|     } | ||||
|  | ||||
|     public function clearCacheFiles() | ||||
|     { | ||||
|         $this->twig->clearCacheFiles(); | ||||
|     } | ||||
|  | ||||
|     public function getLexer() | ||||
|     { | ||||
|         return $this->twig->getLexer(); | ||||
|     } | ||||
|  | ||||
|     public function setLexer(Twig_LexerInterface $lexer) | ||||
|     { | ||||
|         $this->twig->setLexer($lexer); | ||||
|     } | ||||
|  | ||||
|     public function tokenize($source, $name = null) | ||||
|     { | ||||
|         return $this->twig->tokenize($source, $name); | ||||
|     } | ||||
|  | ||||
|     public function getParser() | ||||
|     { | ||||
|         return $this->twig->getParser(); | ||||
|     } | ||||
|  | ||||
|     public function setParser(Twig_ParserInterface $parser) | ||||
|     { | ||||
|         $this->twig->setParser($parser); | ||||
|     } | ||||
|  | ||||
|     public function parse(Twig_TokenStream $tokens) | ||||
|     { | ||||
|         return $this->twig->parse($tokens); | ||||
|     } | ||||
|  | ||||
|     public function getCompiler() | ||||
|     { | ||||
|         return $this->twig->getCompiler(); | ||||
|     } | ||||
|  | ||||
|     public function setCompiler(Twig_CompilerInterface $compiler) | ||||
|     { | ||||
|         $this->twig->setCompiler($compiler); | ||||
|     } | ||||
|  | ||||
|     public function compile(Twig_NodeInterface $node) | ||||
|     { | ||||
|         return $this->twig->compile($node); | ||||
|     } | ||||
|  | ||||
|     public function compileSource($source, $name = null) | ||||
|     { | ||||
|         return $this->twig->compileSource($source, $name); | ||||
|     } | ||||
|  | ||||
|     public function setLoader(Twig_LoaderInterface $loader) | ||||
|     { | ||||
|         $this->twig->setLoader($loader); | ||||
|     } | ||||
|  | ||||
|     public function getLoader() | ||||
|     { | ||||
|         return $this->twig->getLoader(); | ||||
|     } | ||||
|  | ||||
|     public function setCharset($charset) | ||||
|     { | ||||
|         $this->twig->setCharset($charset); | ||||
|     } | ||||
|  | ||||
|     public function getCharset() | ||||
|     { | ||||
|         return $this->twig->getCharset(); | ||||
|     } | ||||
|  | ||||
|     public function initRuntime() | ||||
|     { | ||||
|         $this->twig->initRuntime(); | ||||
|     } | ||||
|  | ||||
|     public function hasExtension($name) | ||||
|     { | ||||
|         return $this->twig->hasExtension($name); | ||||
|     } | ||||
|  | ||||
|     public function getExtension($name) | ||||
|     { | ||||
|         return $this->twig->getExtension($name); | ||||
|     } | ||||
|  | ||||
|     public function addExtension(Twig_ExtensionInterface $extension) | ||||
|     { | ||||
|         $this->twig->addExtension($extension); | ||||
|     } | ||||
|  | ||||
|     public function removeExtension($name) | ||||
|     { | ||||
|         $this->twig->removeExtension($name); | ||||
|     } | ||||
|  | ||||
|     public function setExtensions(array $extensions) | ||||
|     { | ||||
|         $this->twig->setExtensions($extensions); | ||||
|     } | ||||
|  | ||||
|     public function getExtensions() | ||||
|     { | ||||
|         return $this->twig->getExtensions(); | ||||
|     } | ||||
|  | ||||
|     public function addTokenParser(Twig_TokenParserInterface $parser) | ||||
|     { | ||||
|         $this->twig->addTokenParser($parser); | ||||
|     } | ||||
|  | ||||
|     public function getTokenParsers() | ||||
|     { | ||||
|         return $this->twig->getTokenParsers(); | ||||
|     } | ||||
|  | ||||
|     public function getTags() | ||||
|     { | ||||
|         return $this->twig->getTags(); | ||||
|     } | ||||
|  | ||||
|     public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) | ||||
|     { | ||||
|         $this->twig->addNodeVisitor($visitor); | ||||
|     } | ||||
|  | ||||
|     public function getNodeVisitors() | ||||
|     { | ||||
|         return $this->twig->getNodeVisitors(); | ||||
|     } | ||||
|  | ||||
|     public function addFilter($name, $filter = null) | ||||
|     { | ||||
|         $this->twig->addFilter($name, $filter); | ||||
|     } | ||||
|  | ||||
|     public function getFilter($name) | ||||
|     { | ||||
|         return $this->twig->getFilter($name); | ||||
|     } | ||||
|  | ||||
|     public function registerUndefinedFilterCallback($callable) | ||||
|     { | ||||
|         $this->twig->registerUndefinedFilterCallback($callable); | ||||
|     } | ||||
|  | ||||
|     public function getFilters() | ||||
|     { | ||||
|         return $this->twig->getFilters(); | ||||
|     } | ||||
|  | ||||
|     public function addTest($name, $test = null) | ||||
|     { | ||||
|         $this->twig->addTest($name, $test); | ||||
|     } | ||||
|  | ||||
|     public function getTests() | ||||
|     { | ||||
|         return $this->twig->getTests(); | ||||
|     } | ||||
|  | ||||
|     public function getTest($name) | ||||
|     { | ||||
|         return $this->twig->getTest($name); | ||||
|     } | ||||
|  | ||||
|     public function addFunction($name, $function = null) | ||||
|     { | ||||
|         $this->twig->addFunction($name, $function); | ||||
|     } | ||||
|  | ||||
|     public function getFunction($name) | ||||
|     { | ||||
|         return $this->twig->getFunction($name); | ||||
|     } | ||||
|  | ||||
|     public function registerUndefinedFunctionCallback($callable) | ||||
|     { | ||||
|         $this->twig->registerUndefinedFunctionCallback($callable); | ||||
|     } | ||||
|  | ||||
|     public function getFunctions() | ||||
|     { | ||||
|         return $this->twig->getFunctions(); | ||||
|     } | ||||
|  | ||||
|     public function addGlobal($name, $value) | ||||
|     { | ||||
|         $this->twig->addGlobal($name, $value); | ||||
|     } | ||||
|  | ||||
|     public function getGlobals() | ||||
|     { | ||||
|         return $this->twig->getGlobals(); | ||||
|     } | ||||
|  | ||||
|     public function mergeGlobals(array $context) | ||||
|     { | ||||
|         return $this->twig->mergeGlobals($context); | ||||
|     } | ||||
|  | ||||
|     public function getUnaryOperators() | ||||
|     { | ||||
|         return $this->twig->getUnaryOperators(); | ||||
|     } | ||||
|  | ||||
|     public function getBinaryOperators() | ||||
|     { | ||||
|         return $this->twig->getBinaryOperators(); | ||||
|     } | ||||
|  | ||||
|     public function computeAlternatives($name, $items) | ||||
|     { | ||||
|         return $this->twig->computeAlternatives($name, $items); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										138
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/Twig/TraceableTwigTemplate.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										138
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/Twig/TraceableTwigTemplate.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,138 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\Bridge\Twig; | ||||
|  | ||||
| use Twig_Template; | ||||
| use Twig_TemplateInterface; | ||||
|  | ||||
| /** | ||||
|  * Wraps a Twig_Template to add profiling features | ||||
|  *  | ||||
|  * @deprecated | ||||
|  */ | ||||
| class TraceableTwigTemplate extends Twig_Template implements Twig_TemplateInterface | ||||
| { | ||||
|     protected $template; | ||||
|  | ||||
|     /** | ||||
|      * @param TraceableTwigEnvironment $env | ||||
|      * @param Twig_Template $template | ||||
|      */ | ||||
|     public function __construct(TraceableTwigEnvironment $env, Twig_Template $template) | ||||
|     { | ||||
|         $this->env = $env; | ||||
|         $this->template = $template; | ||||
|     } | ||||
|  | ||||
|     public function __call($name, $arguments) | ||||
|     { | ||||
|         return call_user_func_array(array($this->template, $name), $arguments); | ||||
|     } | ||||
|  | ||||
|     public function doDisplay(array $context, array $blocks = array()) | ||||
|     { | ||||
|         return $this->template->doDisplay($context, $blocks); | ||||
|     } | ||||
|  | ||||
|     public function getTemplateName() | ||||
|     { | ||||
|         return $this->template->getTemplateName(); | ||||
|     } | ||||
|  | ||||
|     public function getEnvironment() | ||||
|     { | ||||
|         return $this->template->getEnvironment(); | ||||
|     } | ||||
|  | ||||
|     public function getParent(array $context) | ||||
|     { | ||||
|         return $this->template->getParent($context); | ||||
|     } | ||||
|  | ||||
|     public function isTraitable() | ||||
|     { | ||||
|         return $this->template->isTraitable(); | ||||
|     } | ||||
|  | ||||
|     public function displayParentBlock($name, array $context, array $blocks = array()) | ||||
|     { | ||||
|         $this->template->displayParentBlock($name, $context, $blocks); | ||||
|     } | ||||
|  | ||||
|     public function displayBlock($name, array $context, array $blocks = array(), $useBlocks = true) | ||||
|     { | ||||
|         $this->template->displayBlock($name, $context, $blocks, $useBlocks); | ||||
|     } | ||||
|  | ||||
|     public function renderParentBlock($name, array $context, array $blocks = array()) | ||||
|     { | ||||
|         return $this->template->renderParentBlock($name, $context, $blocks); | ||||
|     } | ||||
|  | ||||
|     public function renderBlock($name, array $context, array $blocks = array(), $useBlocks = true) | ||||
|     { | ||||
|         return $this->template->renderBlock($name, $context, $blocks, $useBlocks); | ||||
|     } | ||||
|  | ||||
|     public function hasBlock($name) | ||||
|     { | ||||
|         return $this->template->hasBlock($name); | ||||
|     } | ||||
|  | ||||
|     public function getBlockNames() | ||||
|     { | ||||
|         return $this->template->getBlockNames(); | ||||
|     } | ||||
|  | ||||
|     public function getBlocks() | ||||
|     { | ||||
|         return $this->template->getBlocks(); | ||||
|     } | ||||
|  | ||||
|     public function display(array $context, array $blocks = array()) | ||||
|     { | ||||
|         $start = microtime(true); | ||||
|         $this->template->display($context, $blocks); | ||||
|         $end = microtime(true); | ||||
|  | ||||
|         if ($timeDataCollector = $this->env->getTimeDataCollector()) { | ||||
|             $name = sprintf("twig.render(%s)", $this->template->getTemplateName()); | ||||
|             $timeDataCollector->addMeasure($name, $start, $end); | ||||
|         } | ||||
|  | ||||
|         $this->env->addRenderedTemplate(array( | ||||
|             'name' => $this->template->getTemplateName(), | ||||
|             'render_time' => $end - $start | ||||
|         )); | ||||
|     } | ||||
|  | ||||
|     public function render(array $context) | ||||
|     { | ||||
|         $level = ob_get_level(); | ||||
|         ob_start(); | ||||
|         try { | ||||
|             $this->display($context); | ||||
|         } catch (Exception $e) { | ||||
|             while (ob_get_level() > $level) { | ||||
|                 ob_end_clean(); | ||||
|             } | ||||
|  | ||||
|             throw $e; | ||||
|         } | ||||
|  | ||||
|         return ob_get_clean(); | ||||
|     } | ||||
|  | ||||
|     public static function clearCache() | ||||
|     { | ||||
|         Twig_Template::clearCache(); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										89
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/Twig/TwigCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/Twig/TwigCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,89 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\Bridge\Twig; | ||||
|  | ||||
| use DebugBar\DataCollector\AssetProvider; | ||||
| use DebugBar\DataCollector\DataCollector; | ||||
| use DebugBar\DataCollector\Renderable; | ||||
|  | ||||
| /** | ||||
|  * Collects data about rendered templates | ||||
|  * | ||||
|  * http://twig.sensiolabs.org/ | ||||
|  * | ||||
|  * Your Twig_Environment object needs to be wrapped in a | ||||
|  * TraceableTwigEnvironment object | ||||
|  * | ||||
|  * <code> | ||||
|  * $env = new TraceableTwigEnvironment(new Twig_Environment($loader)); | ||||
|  * $debugbar->addCollector(new TwigCollector($env)); | ||||
|  * </code> | ||||
|  *  | ||||
|  * @deprecated use DebugBar\Bridge\TwigProfileCollector instead | ||||
|  */ | ||||
| class TwigCollector extends DataCollector implements Renderable, AssetProvider | ||||
| { | ||||
|     public function __construct(TraceableTwigEnvironment $twig) | ||||
|     { | ||||
|         $this->twig = $twig; | ||||
|     } | ||||
|  | ||||
|     public function collect() | ||||
|     { | ||||
|         $templates = array(); | ||||
|         $accuRenderTime = 0; | ||||
|  | ||||
|         foreach ($this->twig->getRenderedTemplates() as $tpl) { | ||||
|             $accuRenderTime += $tpl['render_time']; | ||||
|             $templates[] = array( | ||||
|                 'name' => $tpl['name'], | ||||
|                 'render_time' => $tpl['render_time'], | ||||
|                 'render_time_str' => $this->formatDuration($tpl['render_time']) | ||||
|             ); | ||||
|         } | ||||
|  | ||||
|         return array( | ||||
|             'nb_templates' => count($templates), | ||||
|             'templates' => $templates, | ||||
|             'accumulated_render_time' => $accuRenderTime, | ||||
|             'accumulated_render_time_str' => $this->formatDuration($accuRenderTime) | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     public function getName() | ||||
|     { | ||||
|         return 'twig'; | ||||
|     } | ||||
|  | ||||
|     public function getWidgets() | ||||
|     { | ||||
|         return array( | ||||
|             'twig' => array( | ||||
|                 'icon' => 'leaf', | ||||
|                 'widget' => 'PhpDebugBar.Widgets.TemplatesWidget', | ||||
|                 'map' => 'twig', | ||||
|                 'default' => json_encode(array('templates' => array())), | ||||
|             ), | ||||
|             'twig:badge' => array( | ||||
|                 'map' => 'twig.nb_templates', | ||||
|                 'default' => 0 | ||||
|             ) | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     public function getAssets() | ||||
|     { | ||||
|         return array( | ||||
|             'css' => 'widgets/templates/widget.css', | ||||
|             'js' => 'widgets/templates/widget.js' | ||||
|         ); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										199
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/TwigProfileCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										199
									
								
								vendor/maximebf/debugbar/src/DebugBar/Bridge/TwigProfileCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,199 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2017 Tim Riemenschneider | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\Bridge; | ||||
|  | ||||
| use DebugBar\DataCollector\AssetProvider; | ||||
| use DebugBar\DataCollector\DataCollector; | ||||
| use DebugBar\DataCollector\Renderable; | ||||
|  | ||||
| /** | ||||
|  * Collects data about rendered templates | ||||
|  * | ||||
|  * http://twig.sensiolabs.org/ | ||||
|  * | ||||
|  * A Twig_Extension_Profiler should be added to your Twig_Environment | ||||
|  * The root-Twig_Profiler_Profile-object should then be injected into this collector | ||||
|  * | ||||
|  * you can optionally provide the Twig_Environment or the Twig_Loader to also create | ||||
|  * debug-links. | ||||
|  * | ||||
|  * @see \Twig_Extension_Profiler, \Twig_Profiler_Profile | ||||
|  * | ||||
|  * <code> | ||||
|  * $env = new Twig_Environment($loader); // Or from a PSR11-container | ||||
|  * $profile = new Twig_Profiler_Profile(); | ||||
|  * $env->addExtension(new Twig_Extension_Profile($profile)); | ||||
|  * $debugbar->addCollector(new TwigProfileCollector($profile, $env)); | ||||
|  * // or: $debugbar->addCollector(new TwigProfileCollector($profile, $loader)); | ||||
|  * </code> | ||||
|  * | ||||
|  * @deprecated Use `\Debugbar\Bridge\NamespacedTwigProfileCollector` instead for Twig 2.x and 3.x | ||||
|  */ | ||||
| class TwigProfileCollector extends DataCollector implements Renderable, AssetProvider | ||||
| { | ||||
|     /** | ||||
|      * @var \Twig_Profiler_Profile | ||||
|      */ | ||||
|     private $profile; | ||||
|     /** | ||||
|      * @var \Twig_LoaderInterface | ||||
|      */ | ||||
|     private $loader; | ||||
|     /** @var int */ | ||||
|     private $templateCount; | ||||
|     /** @var int */ | ||||
|     private $blockCount; | ||||
|     /** @var int */ | ||||
|     private $macroCount; | ||||
|     /** | ||||
|      * @var array[] { | ||||
|      * @var string $name | ||||
|      * @var int    $render_time | ||||
|      * @var string $render_time_str | ||||
|      * @var string $memory_str | ||||
|      * @var string $xdebug_link | ||||
|      * } | ||||
|      */ | ||||
|     private $templates; | ||||
|  | ||||
|     /** | ||||
|      * TwigProfileCollector constructor. | ||||
|      * | ||||
|      * @param \Twig_Profiler_Profile $profile | ||||
|      * @param \Twig_LoaderInterface|\Twig_Environment $loaderOrEnv | ||||
|      */ | ||||
|     public function __construct(\Twig_Profiler_Profile $profile, $loaderOrEnv = null) | ||||
|     { | ||||
|         $this->profile     = $profile; | ||||
|         if ($loaderOrEnv instanceof \Twig_Environment) { | ||||
|             $loaderOrEnv = $loaderOrEnv->getLoader(); | ||||
|         } | ||||
|         $this->loader = $loaderOrEnv; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns a hash where keys are control names and their values | ||||
|      * an array of options as defined in {@see DebugBar\JavascriptRenderer::addControl()} | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getWidgets() | ||||
|     { | ||||
|         return array( | ||||
|             'twig'       => array( | ||||
|                 'icon'    => 'leaf', | ||||
|                 'widget'  => 'PhpDebugBar.Widgets.TemplatesWidget', | ||||
|                 'map'     => 'twig', | ||||
|                 'default' => json_encode(array('templates' => array())), | ||||
|             ), | ||||
|             'twig:badge' => array( | ||||
|                 'map'     => 'twig.badge', | ||||
|                 'default' => 0, | ||||
|             ), | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getAssets() | ||||
|     { | ||||
|         return array( | ||||
|             'css' => 'widgets/templates/widget.css', | ||||
|             'js'  => 'widgets/templates/widget.js', | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Called by the DebugBar when data needs to be collected | ||||
|      * | ||||
|      * @return array Collected data | ||||
|      */ | ||||
|     public function collect() | ||||
|     { | ||||
|         $this->templateCount = $this->blockCount = $this->macroCount = 0; | ||||
|         $this->templates     = array(); | ||||
|         $this->computeData($this->profile); | ||||
|  | ||||
|         return array( | ||||
|             'nb_templates'                => $this->templateCount, | ||||
|             'nb_blocks'                   => $this->blockCount, | ||||
|             'nb_macros'                   => $this->macroCount, | ||||
|             'templates'                   => $this->templates, | ||||
|             'accumulated_render_time'     => $this->profile->getDuration(), | ||||
|             'accumulated_render_time_str' => $this->getDataFormatter()->formatDuration($this->profile->getDuration()), | ||||
|             'memory_usage_str'            => $this->getDataFormatter()->formatBytes($this->profile->getMemoryUsage()), | ||||
|             'callgraph'                   => $this->getHtmlCallGraph(), | ||||
|             'badge'                       => implode( | ||||
|                 '/', | ||||
|                 array( | ||||
|                     $this->templateCount, | ||||
|                     $this->blockCount, | ||||
|                     $this->macroCount, | ||||
|                 ) | ||||
|             ), | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the unique name of the collector | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getName() | ||||
|     { | ||||
|         return 'twig'; | ||||
|     } | ||||
|  | ||||
|     public function getHtmlCallGraph() | ||||
|     { | ||||
|         $dumper = new \Twig_Profiler_Dumper_Html(); | ||||
|  | ||||
|         return $dumper->dump($this->profile); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get an Xdebug Link to a file | ||||
|      * | ||||
|      * @return array { | ||||
|      *  @var string url | ||||
|      *  @var bool ajax | ||||
|      * } | ||||
|      */ | ||||
|     public function getXdebugLink($template, $line = 1) | ||||
|     { | ||||
|         if (is_null($this->loader)) { | ||||
|             return null; | ||||
|         } | ||||
|         $file = $this->loader->getSourceContext($template)->getPath(); | ||||
|  | ||||
|         return parent::getXdebugLink($file, $line); | ||||
|     } | ||||
|  | ||||
|     private function computeData(\Twig_Profiler_Profile $profile) | ||||
|     { | ||||
|         $this->templateCount += ($profile->isTemplate() ? 1 : 0); | ||||
|         $this->blockCount    += ($profile->isBlock() ? 1 : 0); | ||||
|         $this->macroCount    += ($profile->isMacro() ? 1 : 0); | ||||
|         if ($profile->isTemplate()) { | ||||
|             $this->templates[] = array( | ||||
|                 'name'            => $profile->getName(), | ||||
|                 'render_time'     => $profile->getDuration(), | ||||
|                 'render_time_str' => $this->getDataFormatter()->formatDuration($profile->getDuration()), | ||||
|                 'memory_str'      => $this->getDataFormatter()->formatBytes($profile->getMemoryUsage()), | ||||
|                 'xdebug_link'     => $this->getXdebugLink($profile->getTemplate()), | ||||
|             ); | ||||
|         } | ||||
|         foreach ($profile as $p) { | ||||
|             $this->computeData($p); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										191
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/AggregatedCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										191
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/AggregatedCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,191 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\DataCollector; | ||||
|  | ||||
| use ArrayAccess; | ||||
| use DebugBar\DebugBarException; | ||||
|  | ||||
| /** | ||||
|  * Aggregates data from multiple collectors | ||||
|  * | ||||
|  * <code> | ||||
|  * $aggcollector = new AggregateCollector('foobar'); | ||||
|  * $aggcollector->addCollector(new MessagesCollector('msg1')); | ||||
|  * $aggcollector->addCollector(new MessagesCollector('msg2')); | ||||
|  * $aggcollector['msg1']->addMessage('hello world'); | ||||
|  * </code> | ||||
|  */ | ||||
| class AggregatedCollector implements DataCollectorInterface, ArrayAccess | ||||
| { | ||||
|     protected $name; | ||||
|  | ||||
|     protected $mergeProperty; | ||||
|  | ||||
|     protected $sort; | ||||
|  | ||||
|     protected $collectors = array(); | ||||
|  | ||||
|     /** | ||||
|      * @param string $name | ||||
|      * @param string $mergeProperty | ||||
|      * @param boolean $sort | ||||
|      */ | ||||
|     public function __construct($name, $mergeProperty = null, $sort = false) | ||||
|     { | ||||
|         $this->name = $name; | ||||
|         $this->mergeProperty = $mergeProperty; | ||||
|         $this->sort = $sort; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param DataCollectorInterface $collector | ||||
|      */ | ||||
|     public function addCollector(DataCollectorInterface $collector) | ||||
|     { | ||||
|         $this->collectors[$collector->getName()] = $collector; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getCollectors() | ||||
|     { | ||||
|         return $this->collectors; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Merge data from one of the key/value pair of the collected data | ||||
|      * | ||||
|      * @param string $property | ||||
|      */ | ||||
|     public function setMergeProperty($property) | ||||
|     { | ||||
|         $this->mergeProperty = $property; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getMergeProperty() | ||||
|     { | ||||
|         return $this->mergeProperty; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sorts the collected data | ||||
|      * | ||||
|      * If true, sorts using sort() | ||||
|      * If it is a string, sorts the data using the value from a key/value pair of the array | ||||
|      * | ||||
|      * @param bool|string $sort | ||||
|      */ | ||||
|     public function setSort($sort) | ||||
|     { | ||||
|         $this->sort = $sort; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return bool|string | ||||
|      */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return $this->sort; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function collect() | ||||
|     { | ||||
|         $aggregate = array(); | ||||
|         foreach ($this->collectors as $collector) { | ||||
|             $data = $collector->collect(); | ||||
|             if ($this->mergeProperty !== null) { | ||||
|                 $data = $data[$this->mergeProperty]; | ||||
|             } | ||||
|             $aggregate = array_merge($aggregate, $data); | ||||
|         } | ||||
|  | ||||
|         return $this->sort($aggregate); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sorts the collected data | ||||
|      * | ||||
|      * @param array $data | ||||
|      * @return array | ||||
|      */ | ||||
|     protected function sort($data) | ||||
|     { | ||||
|         if (is_string($this->sort)) { | ||||
|             $p = $this->sort; | ||||
|             usort($data, function ($a, $b) use ($p) { | ||||
|                 if ($a[$p] == $b[$p]) { | ||||
|                     return 0; | ||||
|                 } | ||||
|                 return $a[$p] < $b[$p] ? -1 : 1; | ||||
|             }); | ||||
|         } elseif ($this->sort === true) { | ||||
|             sort($data); | ||||
|         } | ||||
|         return $data; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getName() | ||||
|     { | ||||
|         return $this->name; | ||||
|     } | ||||
|  | ||||
|     // -------------------------------------------- | ||||
|     // ArrayAccess implementation | ||||
|  | ||||
|     /** | ||||
|      * @param mixed $key | ||||
|      * @param mixed $value | ||||
|      * @throws DebugBarException | ||||
|      */ | ||||
|     public function offsetSet($key, $value): void | ||||
|     { | ||||
|         throw new DebugBarException("AggregatedCollector[] is read-only"); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param mixed $key | ||||
|      * @return mixed | ||||
|      */ | ||||
|      | ||||
|     #[\ReturnTypeWillChange] | ||||
|     public function offsetGet($key) | ||||
|     { | ||||
|         return $this->collectors[$key]; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param mixed $key | ||||
|      * @return bool | ||||
|      */ | ||||
|     public function offsetExists($key): bool | ||||
|     { | ||||
|         return isset($this->collectors[$key]); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param mixed $key | ||||
|      * @throws DebugBarException | ||||
|      */ | ||||
|     public function offsetUnset($key): void | ||||
|     { | ||||
|         throw new DebugBarException("AggregatedCollector[] is read-only"); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										43
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/AssetProvider.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/AssetProvider.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,43 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\DataCollector; | ||||
|  | ||||
| /** | ||||
|  * Indicates that a DataCollector provides some assets | ||||
|  */ | ||||
| interface AssetProvider | ||||
| { | ||||
|     /** | ||||
|      * Returns an array with the following keys: | ||||
|      *  - base_path | ||||
|      *  - base_url | ||||
|      *  - css: an array of filenames | ||||
|      *  - js: an array of filenames | ||||
|      *  - inline_css: an array map of content ID to inline CSS content (not including <style> tag) | ||||
|      *  - inline_js: an array map of content ID to inline JS content (not including <script> tag) | ||||
|      *  - inline_head: an array map of content ID to arbitrary inline HTML content (typically | ||||
|      *        <style>/<script> tags); it must be embedded within the <head> element | ||||
|      * | ||||
|      * All keys are optional. | ||||
|      * | ||||
|      * Ideally, you should store static assets in filenames that are returned via the normal css/js | ||||
|      * keys.  However, the inline asset elements are useful when integrating with 3rd-party | ||||
|      * libraries that require static assets that are only available in an inline format. | ||||
|      * | ||||
|      * The inline content arrays require special string array keys:  the caller of this function | ||||
|      * will use them to deduplicate content.  This is particularly useful if multiple instances of | ||||
|      * the same asset provider are used.  Inline assets from all collectors are merged together into | ||||
|      * the same array, so these content IDs effectively deduplicate the inline assets. | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     function getAssets(); | ||||
| } | ||||
							
								
								
									
										120
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/ConfigCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										120
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/ConfigCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,120 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\DataCollector; | ||||
|  | ||||
| /** | ||||
|  * Collects array data | ||||
|  */ | ||||
| class ConfigCollector extends DataCollector implements Renderable, AssetProvider | ||||
| { | ||||
|     protected $name; | ||||
|  | ||||
|     protected $data; | ||||
|  | ||||
|     // The HTML var dumper requires debug bar users to support the new inline assets, which not all | ||||
|     // may support yet - so return false by default for now. | ||||
|     protected $useHtmlVarDumper = false; | ||||
|  | ||||
|     /** | ||||
|      * Sets a flag indicating whether the Symfony HtmlDumper will be used to dump variables for | ||||
|      * rich variable rendering. | ||||
|      * | ||||
|      * @param bool $value | ||||
|      * @return $this | ||||
|      */ | ||||
|     public function useHtmlVarDumper($value = true) | ||||
|     { | ||||
|         $this->useHtmlVarDumper = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Indicates whether the Symfony HtmlDumper will be used to dump variables for rich variable | ||||
|      * rendering. | ||||
|      * | ||||
|      * @return mixed | ||||
|      */ | ||||
|     public function isHtmlVarDumperUsed() | ||||
|     { | ||||
|         return $this->useHtmlVarDumper; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param array  $data | ||||
|      * @param string $name | ||||
|      */ | ||||
|     public function __construct(array $data = array(), $name = 'config') | ||||
|     { | ||||
|         $this->name = $name; | ||||
|         $this->data = $data; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sets the data | ||||
|      * | ||||
|      * @param array $data | ||||
|      */ | ||||
|     public function setData(array $data) | ||||
|     { | ||||
|         $this->data = $data; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function collect() | ||||
|     { | ||||
|         $data = array(); | ||||
|         foreach ($this->data as $k => $v) { | ||||
|             if ($this->isHtmlVarDumperUsed()) { | ||||
|                 $v = $this->getVarDumper()->renderVar($v); | ||||
|             } else if (!is_string($v)) { | ||||
|                 $v = $this->getDataFormatter()->formatVar($v); | ||||
|             } | ||||
|             $data[$k] = $v; | ||||
|         } | ||||
|         return $data; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getName() | ||||
|     { | ||||
|         return $this->name; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getAssets() { | ||||
|         return $this->isHtmlVarDumperUsed() ? $this->getVarDumper()->getAssets() : array(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getWidgets() | ||||
|     { | ||||
|         $name = $this->getName(); | ||||
|         $widget = $this->isHtmlVarDumperUsed() | ||||
|             ? "PhpDebugBar.Widgets.HtmlVariableListWidget" | ||||
|             : "PhpDebugBar.Widgets.VariableListWidget"; | ||||
|         return array( | ||||
|             "$name" => array( | ||||
|                 "icon" => "gear", | ||||
|                 "widget" => $widget, | ||||
|                 "map" => "$name", | ||||
|                 "default" => "{}" | ||||
|             ) | ||||
|         ); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										234
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/DataCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										234
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/DataCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,234 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\DataCollector; | ||||
|  | ||||
| use DebugBar\DataFormatter\DataFormatter; | ||||
| use DebugBar\DataFormatter\DataFormatterInterface; | ||||
| use DebugBar\DataFormatter\DebugBarVarDumper; | ||||
|  | ||||
| /** | ||||
|  * Abstract class for data collectors | ||||
|  */ | ||||
| abstract class DataCollector implements DataCollectorInterface | ||||
| { | ||||
|     private static $defaultDataFormatter; | ||||
|     private static $defaultVarDumper; | ||||
|  | ||||
|     protected $dataFormater; | ||||
|     protected $varDumper; | ||||
|     protected $xdebugLinkTemplate = ''; | ||||
|     protected $xdebugShouldUseAjax = false; | ||||
|     protected $xdebugReplacements = array(); | ||||
|  | ||||
|     /** | ||||
|      * Sets the default data formater instance used by all collectors subclassing this class | ||||
|      * | ||||
|      * @param DataFormatterInterface $formater | ||||
|      */ | ||||
|     public static function setDefaultDataFormatter(DataFormatterInterface $formater) | ||||
|     { | ||||
|         self::$defaultDataFormatter = $formater; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the default data formater | ||||
|      * | ||||
|      * @return DataFormatterInterface | ||||
|      */ | ||||
|     public static function getDefaultDataFormatter() | ||||
|     { | ||||
|         if (self::$defaultDataFormatter === null) { | ||||
|             self::$defaultDataFormatter = new DataFormatter(); | ||||
|         } | ||||
|         return self::$defaultDataFormatter; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sets the data formater instance used by this collector | ||||
|      * | ||||
|      * @param DataFormatterInterface $formater | ||||
|      * @return $this | ||||
|      */ | ||||
|     public function setDataFormatter(DataFormatterInterface $formater) | ||||
|     { | ||||
|         $this->dataFormater = $formater; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return DataFormatterInterface | ||||
|      */ | ||||
|     public function getDataFormatter() | ||||
|     { | ||||
|         if ($this->dataFormater === null) { | ||||
|             $this->dataFormater = self::getDefaultDataFormatter(); | ||||
|         } | ||||
|         return $this->dataFormater; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get an Xdebug Link to a file | ||||
|      * | ||||
|      * @param string $file | ||||
|      * @param int    $line | ||||
|      * | ||||
|      * @return array { | ||||
|      * @var string   $url | ||||
|      * @var bool     $ajax should be used to open the url instead of a normal links | ||||
|      * } | ||||
|      */ | ||||
|     public function getXdebugLink($file, $line = 1) | ||||
|     { | ||||
|         if (count($this->xdebugReplacements)) { | ||||
|             $file = strtr($file, $this->xdebugReplacements); | ||||
|         } | ||||
|  | ||||
|         $url = strtr($this->getXdebugLinkTemplate(), ['%f' => $file, '%l' => $line]); | ||||
|         if ($url) { | ||||
|             return ['url' => $url, 'ajax' => $this->getXdebugShouldUseAjax()]; | ||||
|         } | ||||
|     } | ||||
|    | ||||
|     /**   | ||||
|      * Sets the default variable dumper used by all collectors subclassing this class | ||||
|      * | ||||
|      * @param DebugBarVarDumper $varDumper | ||||
|      */ | ||||
|     public static function setDefaultVarDumper(DebugBarVarDumper $varDumper) | ||||
|     { | ||||
|         self::$defaultVarDumper = $varDumper; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the default variable dumper | ||||
|      * | ||||
|      * @return DebugBarVarDumper | ||||
|      */ | ||||
|     public static function getDefaultVarDumper() | ||||
|     { | ||||
|         if (self::$defaultVarDumper === null) { | ||||
|             self::$defaultVarDumper = new DebugBarVarDumper(); | ||||
|         } | ||||
|         return self::$defaultVarDumper; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sets the variable dumper instance used by this collector | ||||
|      * | ||||
|      * @param DebugBarVarDumper $varDumper | ||||
|      * @return $this | ||||
|      */ | ||||
|     public function setVarDumper(DebugBarVarDumper $varDumper) | ||||
|     { | ||||
|         $this->varDumper = $varDumper; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Gets the variable dumper instance used by this collector; note that collectors using this | ||||
|      * instance need to be sure to return the static assets provided by the variable dumper. | ||||
|      * | ||||
|      * @return DebugBarVarDumper | ||||
|      */ | ||||
|     public function getVarDumper() | ||||
|     { | ||||
|         if ($this->varDumper === null) { | ||||
|             $this->varDumper = self::getDefaultVarDumper(); | ||||
|         } | ||||
|         return $this->varDumper; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @deprecated | ||||
|      */ | ||||
|     public function formatVar($var) | ||||
|     { | ||||
|         return $this->getDataFormatter()->formatVar($var); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @deprecated | ||||
|      */ | ||||
|     public function formatDuration($seconds) | ||||
|     { | ||||
|         return $this->getDataFormatter()->formatDuration($seconds); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @deprecated | ||||
|      */ | ||||
|     public function formatBytes($size, $precision = 2) | ||||
|     { | ||||
|         return $this->getDataFormatter()->formatBytes($size, $precision); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getXdebugLinkTemplate() | ||||
|     { | ||||
|         if (empty($this->xdebugLinkTemplate) && !empty(ini_get('xdebug.file_link_format'))) { | ||||
|             $this->xdebugLinkTemplate = ini_get('xdebug.file_link_format'); | ||||
|         } | ||||
|  | ||||
|         return $this->xdebugLinkTemplate; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param string $xdebugLinkTemplate | ||||
|      * @param bool $shouldUseAjax | ||||
|      */ | ||||
|     public function setXdebugLinkTemplate($xdebugLinkTemplate, $shouldUseAjax = false) | ||||
|     { | ||||
|         if ($xdebugLinkTemplate === 'idea') { | ||||
|             $this->xdebugLinkTemplate  = 'http://localhost:63342/api/file/?file=%f&line=%l'; | ||||
|             $this->xdebugShouldUseAjax = true; | ||||
|         } else { | ||||
|             $this->xdebugLinkTemplate  = $xdebugLinkTemplate; | ||||
|             $this->xdebugShouldUseAjax = $shouldUseAjax; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return bool | ||||
|      */ | ||||
|     public function getXdebugShouldUseAjax() | ||||
|     { | ||||
|         return $this->xdebugShouldUseAjax; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * returns an array of filename-replacements | ||||
|      * | ||||
|      * this is useful f.e. when using vagrant or remote servers, | ||||
|      * where the path of the file is different between server and | ||||
|      * development environment | ||||
|      * | ||||
|      * @return array key-value-pairs of replacements, key = path on server, value = replacement | ||||
|      */ | ||||
|     public function getXdebugReplacements() | ||||
|     { | ||||
|         return $this->xdebugReplacements; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param array $xdebugReplacements | ||||
|      */ | ||||
|     public function setXdebugReplacements($xdebugReplacements) | ||||
|     { | ||||
|         $this->xdebugReplacements = $xdebugReplacements; | ||||
|     } | ||||
|  | ||||
|     public function setXdebugReplacement($serverPath, $replacement) | ||||
|     { | ||||
|         $this->xdebugReplacements[$serverPath] = $replacement; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										31
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/DataCollectorInterface.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/DataCollectorInterface.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\DataCollector; | ||||
|  | ||||
| /** | ||||
|  * DataCollector Interface | ||||
|  */ | ||||
| interface DataCollectorInterface | ||||
| { | ||||
|     /** | ||||
|      * Called by the DebugBar when data needs to be collected | ||||
|      * | ||||
|      * @return array Collected data | ||||
|      */ | ||||
|     function collect(); | ||||
|  | ||||
|     /** | ||||
|      * Returns the unique name of the collector | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     function getName(); | ||||
| } | ||||
							
								
								
									
										177
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/ExceptionsCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										177
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/ExceptionsCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,177 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\DataCollector; | ||||
|  | ||||
| use Exception; | ||||
| use Symfony\Component\Debug\Exception\FatalThrowableError; | ||||
|  | ||||
| /** | ||||
|  * Collects info about exceptions | ||||
|  */ | ||||
| class ExceptionsCollector extends DataCollector implements Renderable | ||||
| { | ||||
|     protected $exceptions = array(); | ||||
|     protected $chainExceptions = false; | ||||
|  | ||||
|     // The HTML var dumper requires debug bar users to support the new inline assets, which not all | ||||
|     // may support yet - so return false by default for now. | ||||
|     protected $useHtmlVarDumper = false; | ||||
|  | ||||
|     /** | ||||
|      * Adds an exception to be profiled in the debug bar | ||||
|      * | ||||
|      * @param Exception $e | ||||
|      * @deprecated in favor on addThrowable | ||||
|      */ | ||||
|     public function addException(Exception $e) | ||||
|     { | ||||
|         $this->addThrowable($e); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Adds a Throwable to be profiled in the debug bar | ||||
|      * | ||||
|      * @param \Throwable $e | ||||
|      */ | ||||
|     public function addThrowable($e) | ||||
|     { | ||||
|         $this->exceptions[] = $e; | ||||
|         if ($this->chainExceptions && $previous = $e->getPrevious()) { | ||||
|             $this->addThrowable($previous); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Configure whether or not all chained exceptions should be shown. | ||||
|      * | ||||
|      * @param bool $chainExceptions | ||||
|      */ | ||||
|     public function setChainExceptions($chainExceptions = true) | ||||
|     { | ||||
|         $this->chainExceptions = $chainExceptions; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the list of exceptions being profiled | ||||
|      * | ||||
|      * @return array[\Throwable] | ||||
|      */ | ||||
|     public function getExceptions() | ||||
|     { | ||||
|         return $this->exceptions; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sets a flag indicating whether the Symfony HtmlDumper will be used to dump variables for | ||||
|      * rich variable rendering. | ||||
|      * | ||||
|      * @param bool $value | ||||
|      * @return $this | ||||
|      */ | ||||
|     public function useHtmlVarDumper($value = true) | ||||
|     { | ||||
|         $this->useHtmlVarDumper = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Indicates whether the Symfony HtmlDumper will be used to dump variables for rich variable | ||||
|      * rendering. | ||||
|      * | ||||
|      * @return mixed | ||||
|      */ | ||||
|     public function isHtmlVarDumperUsed() | ||||
|     { | ||||
|         return $this->useHtmlVarDumper; | ||||
|     } | ||||
|  | ||||
|     public function collect() | ||||
|     { | ||||
|         return array( | ||||
|             'count' => count($this->exceptions), | ||||
|             'exceptions' => array_map(array($this, 'formatThrowableData'), $this->exceptions) | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns exception data as an array | ||||
|      * | ||||
|      * @param Exception $e | ||||
|      * @return array | ||||
|      * @deprecated in favor on formatThrowableData | ||||
|      */ | ||||
|     public function formatExceptionData(Exception $e) | ||||
|     { | ||||
|         return $this->formatThrowableData($e); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns Throwable data as an array | ||||
|      * | ||||
|      * @param \Throwable $e | ||||
|      * @return array | ||||
|      */ | ||||
|     public function formatThrowableData($e) | ||||
|     { | ||||
|         $filePath = $e->getFile(); | ||||
|         if ($filePath && file_exists($filePath)) { | ||||
|             $lines = file($filePath); | ||||
|             $start = $e->getLine() - 4; | ||||
|             $lines = array_slice($lines, $start < 0 ? 0 : $start, 7); | ||||
|         } else { | ||||
|             $lines = array("Cannot open the file ($filePath) in which the exception occurred "); | ||||
|         } | ||||
|  | ||||
|         $traceHtml = null; | ||||
|         if ($this->isHtmlVarDumperUsed()) { | ||||
|             $traceHtml = $this->getVarDumper()->renderVar($e->getTrace()); | ||||
|         } | ||||
|  | ||||
|         return array( | ||||
|             'type' => get_class($e), | ||||
|             'message' => $e->getMessage(), | ||||
|             'code' => $e->getCode(), | ||||
|             'file' => $filePath, | ||||
|             'line' => $e->getLine(), | ||||
|             'stack_trace' => $e->getTraceAsString(), | ||||
|             'stack_trace_html' => $traceHtml, | ||||
|             'surrounding_lines' => $lines, | ||||
|             'xdebug_link' => $this->getXdebugLink($filePath, $e->getLine()) | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getName() | ||||
|     { | ||||
|         return 'exceptions'; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getWidgets() | ||||
|     { | ||||
|         return array( | ||||
|             'exceptions' => array( | ||||
|                 'icon' => 'bug', | ||||
|                 'widget' => 'PhpDebugBar.Widgets.ExceptionsWidget', | ||||
|                 'map' => 'exceptions.exceptions', | ||||
|                 'default' => '[]' | ||||
|             ), | ||||
|             'exceptions:badge' => array( | ||||
|                 'map' => 'exceptions.count', | ||||
|                 'default' => 'null' | ||||
|             ) | ||||
|         ); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										73
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/LocalizationCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/LocalizationCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,73 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\DataCollector; | ||||
|  | ||||
| /** | ||||
|  * Collects info about the current localization state | ||||
|  */ | ||||
| class LocalizationCollector extends DataCollector implements Renderable | ||||
| { | ||||
|     /** | ||||
|      * Get the current locale | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getLocale() | ||||
|     { | ||||
|         return setlocale(LC_ALL, 0); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get the current translations domain | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getDomain() | ||||
|     { | ||||
|         return textdomain(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function collect() | ||||
|     { | ||||
|         return array( | ||||
|           'locale' => $this->getLocale(), | ||||
|           'domain' => $this->getDomain(), | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getName() | ||||
|     { | ||||
|         return 'localization'; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getWidgets() | ||||
|     { | ||||
|         return array( | ||||
|             'domain' => array( | ||||
|                 'icon' => 'bookmark', | ||||
|                 'map'  => 'localization.domain', | ||||
|             ), | ||||
|             'locale' => array( | ||||
|                 'icon' => 'flag', | ||||
|                 'map'  => 'localization.locale', | ||||
|             ) | ||||
|         ); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										96
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/MemoryCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/MemoryCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,96 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\DataCollector; | ||||
|  | ||||
| /** | ||||
|  * Collects info about memory usage | ||||
|  */ | ||||
| class MemoryCollector extends DataCollector implements Renderable | ||||
| { | ||||
|     protected $realUsage = false; | ||||
|  | ||||
|     protected $peakUsage = 0; | ||||
|  | ||||
|     /** | ||||
|      * Returns whether total allocated memory page size is used instead of actual used memory size | ||||
|      * by the application.  See $real_usage parameter on memory_get_peak_usage for details. | ||||
|      * | ||||
|      * @return bool | ||||
|      */ | ||||
|     public function getRealUsage() | ||||
|     { | ||||
|         return $this->realUsage; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sets whether total allocated memory page size is used instead of actual used memory size | ||||
|      * by the application.  See $real_usage parameter on memory_get_peak_usage for details. | ||||
|      * | ||||
|      * @param bool $realUsage | ||||
|      */ | ||||
|     public function setRealUsage($realUsage) | ||||
|     { | ||||
|         $this->realUsage = $realUsage; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the peak memory usage | ||||
|      * | ||||
|      * @return integer | ||||
|      */ | ||||
|     public function getPeakUsage() | ||||
|     { | ||||
|         return $this->peakUsage; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Updates the peak memory usage value | ||||
|      */ | ||||
|     public function updatePeakUsage() | ||||
|     { | ||||
|         $this->peakUsage = memory_get_peak_usage($this->realUsage); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function collect() | ||||
|     { | ||||
|         $this->updatePeakUsage(); | ||||
|         return array( | ||||
|             'peak_usage' => $this->peakUsage, | ||||
|             'peak_usage_str' => $this->getDataFormatter()->formatBytes($this->peakUsage, 0) | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getName() | ||||
|     { | ||||
|         return 'memory'; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getWidgets() | ||||
|     { | ||||
|         return array( | ||||
|             "memory" => array( | ||||
|                 "icon" => "cogs", | ||||
|                 "tooltip" => "Memory Usage", | ||||
|                 "map" => "memory.peak_usage_str", | ||||
|                 "default" => "'0B'" | ||||
|             ) | ||||
|         ); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										21
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/MessagesAggregateInterface.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/MessagesAggregateInterface.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\DataCollector; | ||||
|  | ||||
| interface MessagesAggregateInterface | ||||
| { | ||||
|     /** | ||||
|      * Returns collected messages | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getMessages(); | ||||
| } | ||||
							
								
								
									
										271
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/MessagesCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										271
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/MessagesCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,271 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\DataCollector; | ||||
|  | ||||
| use Psr\Log\AbstractLogger; | ||||
| use DebugBar\DataFormatter\DataFormatterInterface; | ||||
| use DebugBar\DataFormatter\DebugBarVarDumper; | ||||
|  | ||||
| /** | ||||
|  * Provides a way to log messages | ||||
|  */ | ||||
| class MessagesCollector extends AbstractLogger implements DataCollectorInterface, MessagesAggregateInterface, Renderable, AssetProvider | ||||
| { | ||||
|     protected $name; | ||||
|  | ||||
|     protected $messages = array(); | ||||
|  | ||||
|     protected $aggregates = array(); | ||||
|  | ||||
|     protected $dataFormater; | ||||
|  | ||||
|     protected $varDumper; | ||||
|  | ||||
|     // The HTML var dumper requires debug bar users to support the new inline assets, which not all | ||||
|     // may support yet - so return false by default for now. | ||||
|     protected $useHtmlVarDumper = false; | ||||
|  | ||||
|     /** | ||||
|      * @param string $name | ||||
|      */ | ||||
|     public function __construct($name = 'messages') | ||||
|     { | ||||
|         $this->name = $name; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sets the data formater instance used by this collector | ||||
|      * | ||||
|      * @param DataFormatterInterface $formater | ||||
|      * @return $this | ||||
|      */ | ||||
|     public function setDataFormatter(DataFormatterInterface $formater) | ||||
|     { | ||||
|         $this->dataFormater = $formater; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return DataFormatterInterface | ||||
|      */ | ||||
|     public function getDataFormatter() | ||||
|     { | ||||
|         if ($this->dataFormater === null) { | ||||
|             $this->dataFormater = DataCollector::getDefaultDataFormatter(); | ||||
|         } | ||||
|         return $this->dataFormater; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sets the variable dumper instance used by this collector | ||||
|      * | ||||
|      * @param DebugBarVarDumper $varDumper | ||||
|      * @return $this | ||||
|      */ | ||||
|     public function setVarDumper(DebugBarVarDumper $varDumper) | ||||
|     { | ||||
|         $this->varDumper = $varDumper; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Gets the variable dumper instance used by this collector | ||||
|      * | ||||
|      * @return DebugBarVarDumper | ||||
|      */ | ||||
|     public function getVarDumper() | ||||
|     { | ||||
|         if ($this->varDumper === null) { | ||||
|             $this->varDumper = DataCollector::getDefaultVarDumper(); | ||||
|         } | ||||
|         return $this->varDumper; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sets a flag indicating whether the Symfony HtmlDumper will be used to dump variables for | ||||
|      * rich variable rendering.  Be sure to set this flag before logging any messages for the | ||||
|      * first time. | ||||
|      * | ||||
|      * @param bool $value | ||||
|      * @return $this | ||||
|      */ | ||||
|     public function useHtmlVarDumper($value = true) | ||||
|     { | ||||
|         $this->useHtmlVarDumper = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Indicates whether the Symfony HtmlDumper will be used to dump variables for rich variable | ||||
|      * rendering. | ||||
|      * | ||||
|      * @return mixed | ||||
|      */ | ||||
|     public function isHtmlVarDumperUsed() | ||||
|     { | ||||
|         return $this->useHtmlVarDumper; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Adds a message | ||||
|      * | ||||
|      * A message can be anything from an object to a string | ||||
|      * | ||||
|      * @param mixed $message | ||||
|      * @param string $label | ||||
|      */ | ||||
|     public function addMessage($message, $label = 'info', $isString = true) | ||||
|     { | ||||
|         $messageText = $message; | ||||
|         $messageHtml = null; | ||||
|         if (!is_string($message)) { | ||||
|             // Send both text and HTML representations; the text version is used for searches | ||||
|             $messageText = $this->getDataFormatter()->formatVar($message); | ||||
|             if ($this->isHtmlVarDumperUsed()) { | ||||
|                 $messageHtml = $this->getVarDumper()->renderVar($message); | ||||
|             } | ||||
|             $isString = false; | ||||
|         } | ||||
|         $this->messages[] = array( | ||||
|             'message' => $messageText, | ||||
|             'message_html' => $messageHtml, | ||||
|             'is_string' => $isString, | ||||
|             'label' => $label, | ||||
|             'time' => microtime(true) | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Aggregates messages from other collectors | ||||
|      * | ||||
|      * @param MessagesAggregateInterface $messages | ||||
|      */ | ||||
|     public function aggregate(MessagesAggregateInterface $messages) | ||||
|     { | ||||
|         $this->aggregates[] = $messages; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getMessages() | ||||
|     { | ||||
|         $messages = $this->messages; | ||||
|         foreach ($this->aggregates as $collector) { | ||||
|             $msgs = array_map(function ($m) use ($collector) { | ||||
|                 $m['collector'] = $collector->getName(); | ||||
|                 return $m; | ||||
|             }, $collector->getMessages()); | ||||
|             $messages = array_merge($messages, $msgs); | ||||
|         } | ||||
|  | ||||
|         // sort messages by their timestamp | ||||
|         usort($messages, function ($a, $b) { | ||||
|             if ($a['time'] === $b['time']) { | ||||
|                 return 0; | ||||
|             } | ||||
|             return $a['time'] < $b['time'] ? -1 : 1; | ||||
|         }); | ||||
|  | ||||
|         return $messages; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param $level | ||||
|      * @param $message | ||||
|      * @param array $context | ||||
|      */ | ||||
|     public function log($level, $message, array $context = array()): void | ||||
|     { | ||||
|         // For string messages, interpolate the context following PSR-3 | ||||
|         if (is_string($message)) { | ||||
|             $message = $this->interpolate($message, $context); | ||||
|         } | ||||
|         $this->addMessage($message, $level); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Interpolates context values into the message placeholders. | ||||
|      * | ||||
|      * @param $message | ||||
|      * @param array $context | ||||
|      * @return string | ||||
|      */ | ||||
|     function interpolate($message, array $context = array()) | ||||
|     { | ||||
|         // build a replacement array with braces around the context keys | ||||
|         $replace = array(); | ||||
|         foreach ($context as $key => $val) { | ||||
|             // check that the value can be cast to string | ||||
|             if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) { | ||||
|                 $replace['{' . $key . '}'] = $val; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         // interpolate replacement values into the message and return | ||||
|         return strtr($message, $replace); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Deletes all messages | ||||
|      */ | ||||
|     public function clear() | ||||
|     { | ||||
|         $this->messages = array(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function collect() | ||||
|     { | ||||
|         $messages = $this->getMessages(); | ||||
|         return array( | ||||
|             'count' => count($messages), | ||||
|             'messages' => $messages | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getName() | ||||
|     { | ||||
|         return $this->name; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getAssets() { | ||||
|         return $this->isHtmlVarDumperUsed() ? $this->getVarDumper()->getAssets() : array(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getWidgets() | ||||
|     { | ||||
|         $name = $this->getName(); | ||||
|         return array( | ||||
|             "$name" => array( | ||||
|                 'icon' => 'list-alt', | ||||
|                 "widget" => "PhpDebugBar.Widgets.MessagesWidget", | ||||
|                 "map" => "$name.messages", | ||||
|                 "default" => "[]" | ||||
|             ), | ||||
|             "$name:badge" => array( | ||||
|                 "map" => "$name.count", | ||||
|                 "default" => "null" | ||||
|             ) | ||||
|         ); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										209
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/PDO/PDOCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										209
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/PDO/PDOCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,209 @@ | ||||
| <?php | ||||
|  | ||||
| namespace DebugBar\DataCollector\PDO; | ||||
|  | ||||
| use DebugBar\DataCollector\AssetProvider; | ||||
| use DebugBar\DataCollector\DataCollector; | ||||
| use DebugBar\DataCollector\Renderable; | ||||
| use DebugBar\DataCollector\TimeDataCollector; | ||||
|  | ||||
| /** | ||||
|  * Collects data about SQL statements executed with PDO | ||||
|  */ | ||||
| class PDOCollector extends DataCollector implements Renderable, AssetProvider | ||||
| { | ||||
|     protected $connections = array(); | ||||
|  | ||||
|     protected $timeCollector; | ||||
|  | ||||
|     protected $renderSqlWithParams = false; | ||||
|  | ||||
|     protected $sqlQuotationChar = '<>'; | ||||
|  | ||||
|     /** | ||||
|      * @param \PDO $pdo | ||||
|      * @param TimeDataCollector $timeCollector | ||||
|      */ | ||||
|     public function __construct(\PDO $pdo = null, TimeDataCollector $timeCollector = null) | ||||
|     { | ||||
|         $this->timeCollector = $timeCollector; | ||||
|         if ($pdo !== null) { | ||||
|             $this->addConnection($pdo, 'default'); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Renders the SQL of traced statements with params embeded | ||||
|      * | ||||
|      * @param boolean $enabled | ||||
|      */ | ||||
|     public function setRenderSqlWithParams($enabled = true, $quotationChar = '<>') | ||||
|     { | ||||
|         $this->renderSqlWithParams = $enabled; | ||||
|         $this->sqlQuotationChar = $quotationChar; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return bool | ||||
|      */ | ||||
|     public function isSqlRenderedWithParams() | ||||
|     { | ||||
|         return $this->renderSqlWithParams; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getSqlQuotationChar() | ||||
|     { | ||||
|         return $this->sqlQuotationChar; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Adds a new PDO instance to be collector | ||||
|      * | ||||
|      * @param TraceablePDO $pdo | ||||
|      * @param string $name Optional connection name | ||||
|      */ | ||||
|     public function addConnection(\PDO $pdo, $name = null) | ||||
|     { | ||||
|         if ($name === null) { | ||||
|             $name = spl_object_hash($pdo); | ||||
|         } | ||||
|         if (!($pdo instanceof TraceablePDO)) { | ||||
|             $pdo = new TraceablePDO($pdo); | ||||
|         } | ||||
|         $this->connections[$name] = $pdo; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns PDO instances to be collected | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getConnections() | ||||
|     { | ||||
|         return $this->connections; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function collect() | ||||
|     { | ||||
|         $data = array( | ||||
|             'nb_statements' => 0, | ||||
|             'nb_failed_statements' => 0, | ||||
|             'accumulated_duration' => 0, | ||||
|             'memory_usage' => 0, | ||||
|             'peak_memory_usage' => 0, | ||||
|             'statements' => array() | ||||
|         ); | ||||
|  | ||||
|         foreach ($this->connections as $name => $pdo) { | ||||
|             $pdodata = $this->collectPDO($pdo, $this->timeCollector, $name); | ||||
|             $data['nb_statements'] += $pdodata['nb_statements']; | ||||
|             $data['nb_failed_statements'] += $pdodata['nb_failed_statements']; | ||||
|             $data['accumulated_duration'] += $pdodata['accumulated_duration']; | ||||
|             $data['memory_usage'] += $pdodata['memory_usage']; | ||||
|             $data['peak_memory_usage'] = max($data['peak_memory_usage'], $pdodata['peak_memory_usage']); | ||||
|             $data['statements'] = array_merge($data['statements'], | ||||
|                 array_map(function ($s) use ($name) { $s['connection'] = $name; return $s; }, $pdodata['statements'])); | ||||
|         } | ||||
|  | ||||
|         $data['accumulated_duration_str'] = $this->getDataFormatter()->formatDuration($data['accumulated_duration']); | ||||
|         $data['memory_usage_str'] = $this->getDataFormatter()->formatBytes($data['memory_usage']); | ||||
|         $data['peak_memory_usage_str'] = $this->getDataFormatter()->formatBytes($data['peak_memory_usage']); | ||||
|  | ||||
|         return $data; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Collects data from a single TraceablePDO instance | ||||
|      * | ||||
|      * @param TraceablePDO $pdo | ||||
|      * @param TimeDataCollector $timeCollector | ||||
|      * @param string|null $connectionName the pdo connection (eg default | read | write) | ||||
|      * @return array | ||||
|      */ | ||||
|     protected function collectPDO(TraceablePDO $pdo, TimeDataCollector $timeCollector = null, $connectionName = null) | ||||
|     { | ||||
|         if (empty($connectionName) || $connectionName == 'default') { | ||||
|             $connectionName = 'pdo'; | ||||
|         } else { | ||||
|             $connectionName = 'pdo ' . $connectionName; | ||||
|         } | ||||
|         $stmts = array(); | ||||
|         foreach ($pdo->getExecutedStatements() as $stmt) { | ||||
|             $stmts[] = array( | ||||
|                 'sql' => $this->renderSqlWithParams ? $stmt->getSqlWithParams($this->sqlQuotationChar) : $stmt->getSql(), | ||||
|                 'row_count' => $stmt->getRowCount(), | ||||
|                 'stmt_id' => $stmt->getPreparedId(), | ||||
|                 'prepared_stmt' => $stmt->getSql(), | ||||
|                 'params' => (object) $stmt->getParameters(), | ||||
|                 'duration' => $stmt->getDuration(), | ||||
|                 'duration_str' => $this->getDataFormatter()->formatDuration($stmt->getDuration()), | ||||
|                 'memory' => $stmt->getMemoryUsage(), | ||||
|                 'memory_str' => $this->getDataFormatter()->formatBytes($stmt->getMemoryUsage()), | ||||
|                 'end_memory' => $stmt->getEndMemory(), | ||||
|                 'end_memory_str' => $this->getDataFormatter()->formatBytes($stmt->getEndMemory()), | ||||
|                 'is_success' => $stmt->isSuccess(), | ||||
|                 'error_code' => $stmt->getErrorCode(), | ||||
|                 'error_message' => $stmt->getErrorMessage() | ||||
|             ); | ||||
|             if ($timeCollector !== null) { | ||||
|                 $timeCollector->addMeasure($stmt->getSql(), $stmt->getStartTime(), $stmt->getEndTime(), array(), $connectionName); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return array( | ||||
|             'nb_statements' => count($stmts), | ||||
|             'nb_failed_statements' => count($pdo->getFailedExecutedStatements()), | ||||
|             'accumulated_duration' => $pdo->getAccumulatedStatementsDuration(), | ||||
|             'accumulated_duration_str' => $this->getDataFormatter()->formatDuration($pdo->getAccumulatedStatementsDuration()), | ||||
|             'memory_usage' => $pdo->getMemoryUsage(), | ||||
|             'memory_usage_str' => $this->getDataFormatter()->formatBytes($pdo->getPeakMemoryUsage()), | ||||
|             'peak_memory_usage' => $pdo->getPeakMemoryUsage(), | ||||
|             'peak_memory_usage_str' => $this->getDataFormatter()->formatBytes($pdo->getPeakMemoryUsage()), | ||||
|             'statements' => $stmts | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getName() | ||||
|     { | ||||
|         return 'pdo'; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getWidgets() | ||||
|     { | ||||
|         return array( | ||||
|             "database" => array( | ||||
|                 "icon" => "database", | ||||
|                 "widget" => "PhpDebugBar.Widgets.SQLQueriesWidget", | ||||
|                 "map" => "pdo", | ||||
|                 "default" => "[]" | ||||
|             ), | ||||
|             "database:badge" => array( | ||||
|                 "map" => "pdo.nb_statements", | ||||
|                 "default" => 0 | ||||
|             ) | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getAssets() | ||||
|     { | ||||
|         return array( | ||||
|             'css' => 'widgets/sqlqueries/widget.css', | ||||
|             'js' => 'widgets/sqlqueries/widget.js' | ||||
|         ); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										313
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/PDO/TraceablePDO.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										313
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/PDO/TraceablePDO.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,313 @@ | ||||
| <?php | ||||
|  | ||||
| namespace DebugBar\DataCollector\PDO; | ||||
|  | ||||
| use PDO; | ||||
| use PDOException; | ||||
| use DebugBar\DataCollector\PDO\TraceablePDOStatement; | ||||
|  | ||||
| /** | ||||
|  * A PDO proxy which traces statements | ||||
|  */ | ||||
| class TraceablePDO extends PDO | ||||
| { | ||||
|     /** @var PDO */ | ||||
|     protected $pdo; | ||||
|  | ||||
|     /** @var TracedStatement[] */ | ||||
|     protected $executedStatements = []; | ||||
|  | ||||
|     public function __construct(PDO $pdo) | ||||
|     { | ||||
|         $this->pdo = $pdo; | ||||
|         $this->pdo->setAttribute(PDO::ATTR_STATEMENT_CLASS, [TraceablePDOStatement::class, [$this]]); | ||||
|     } | ||||
|  | ||||
| 	/** | ||||
| 	 * Initiates a transaction | ||||
|          * | ||||
| 	 * @link   http://php.net/manual/en/pdo.begintransaction.php | ||||
| 	 * @return bool TRUE on success or FALSE on failure. | ||||
| 	 */ | ||||
|     public function beginTransaction() | ||||
|     { | ||||
|         return $this->pdo->beginTransaction(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Commits a transaction | ||||
|      * | ||||
|      * @link   http://php.net/manual/en/pdo.commit.php | ||||
|      * @return bool TRUE on success or FALSE on failure. | ||||
|      */ | ||||
|     public function commit() | ||||
|     { | ||||
|         return $this->pdo->commit(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Fetch extended error information associated with the last operation on the database handle | ||||
|      * | ||||
|      * @link   http://php.net/manual/en/pdo.errorinfo.php | ||||
|      * @return array PDO::errorInfo returns an array of error information | ||||
|      */ | ||||
|     public function errorCode() | ||||
|     { | ||||
|         return $this->pdo->errorCode(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Fetch extended error information associated with the last operation on the database handle | ||||
|      * | ||||
|      * @link   http://php.net/manual/en/pdo.errorinfo.php | ||||
|      * @return array PDO::errorInfo returns an array of error information | ||||
|      */ | ||||
|     public function errorInfo() | ||||
|     { | ||||
|         return $this->pdo->errorInfo(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Execute an SQL statement and return the number of affected rows | ||||
|      * | ||||
|      * @link   http://php.net/manual/en/pdo.exec.php | ||||
|      * @param  string   $statement | ||||
|      * @return int|bool PDO::exec returns the number of rows that were modified or deleted by the | ||||
|      * SQL statement you issued. If no rows were affected, PDO::exec returns 0. This function may | ||||
|      * return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. | ||||
|      * Please read the section on Booleans for more information | ||||
|      */ | ||||
|     public function exec($statement) | ||||
|     { | ||||
|         return $this->profileCall('exec', $statement, func_get_args()); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Retrieve a database connection attribute | ||||
|      * | ||||
|      * @link   http://php.net/manual/en/pdo.getattribute.php | ||||
|      * @param  int   $attribute One of the PDO::ATTR_* constants | ||||
|      * @return mixed A successful call returns the value of the requested PDO attribute. | ||||
|      * An unsuccessful call returns null. | ||||
|      */ | ||||
|     public function getAttribute($attribute) | ||||
|     { | ||||
|         return $this->pdo->getAttribute($attribute); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Checks if inside a transaction | ||||
|      * | ||||
|      * @link   http://php.net/manual/en/pdo.intransaction.php | ||||
|      * @return bool TRUE if a transaction is currently active, and FALSE if not. | ||||
|      */ | ||||
|     public function inTransaction() | ||||
|     { | ||||
|         return $this->pdo->inTransaction(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the ID of the last inserted row or sequence value | ||||
|      * | ||||
|      * @link   http://php.net/manual/en/pdo.lastinsertid.php | ||||
|      * @param  string $name [optional] | ||||
|      * @return string If a sequence name was not specified for the name parameter, PDO::lastInsertId | ||||
|      * returns a string representing the row ID of the last row that was inserted into the database. | ||||
|      */ | ||||
|     public function lastInsertId($name = null) | ||||
|     { | ||||
|         return $this->pdo->lastInsertId($name); | ||||
|     } | ||||
|  | ||||
| 	/** | ||||
| 	 * Prepares a statement for execution and returns a statement object | ||||
|    * | ||||
| 	 * @link   http://php.net/manual/en/pdo.prepare.php | ||||
| 	 * @param  string $statement This must be a valid SQL statement template for the target DB server. | ||||
| 	 * @param  array  $driver_options [optional] This array holds one or more key=>value pairs to | ||||
| 	 * set attribute values for the PDOStatement object that this method returns. | ||||
| 	 * @return TraceablePDOStatement|bool If the database server successfully prepares the statement, | ||||
|    * PDO::prepare returns a PDOStatement object. If the database server cannot successfully prepare | ||||
|    * the statement, PDO::prepare returns FALSE or emits PDOException (depending on error handling). | ||||
| 	 */ | ||||
|     public function prepare($statement, $driver_options = []) | ||||
|     { | ||||
|         return $this->pdo->prepare($statement, $driver_options); | ||||
|     } | ||||
|  | ||||
| 	/** | ||||
| 	 * Executes an SQL statement, returning a result set as a PDOStatement object | ||||
|    * | ||||
| 	 * @link   http://php.net/manual/en/pdo.query.php | ||||
| 	 * @param  string $statement | ||||
| 	 * @param  int $fetchMode | ||||
| 	 * @param  mixed ...$fetchModeArgs | ||||
| 	 * @return TraceablePDOStatement|bool PDO::query returns a PDOStatement object, or FALSE on | ||||
|    * failure. | ||||
|    */ | ||||
|     public function query($statement, $fetchMode = null, ...$fetchModeArgs) | ||||
|     { | ||||
|         return $this->profileCall('query', $statement, func_get_args()); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Quotes a string for use in a query. | ||||
|      * | ||||
|      * @link   http://php.net/manual/en/pdo.quote.php | ||||
|      * @param  string $string The string to be quoted. | ||||
|      * @param  int    $parameter_type [optional] Provides a data type hint for drivers that have | ||||
|      * alternate quoting styles. | ||||
|      * @return string|bool A quoted string that is theoretically safe to pass into an SQL statement. | ||||
|      * Returns FALSE if the driver does not support quoting in this way. | ||||
|      */ | ||||
|     public function quote($string, $parameter_type = PDO::PARAM_STR) | ||||
|     { | ||||
|         return $this->pdo->quote($string, $parameter_type); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Rolls back a transaction | ||||
|      * | ||||
|      * @link   http://php.net/manual/en/pdo.rollback.php | ||||
|      * @return bool TRUE on success or FALSE on failure. | ||||
|      */ | ||||
|     public function rollBack() | ||||
|     { | ||||
|         return $this->pdo->rollBack(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set an attribute | ||||
|      * | ||||
|      * @link   http://php.net/manual/en/pdo.setattribute.php | ||||
|      * @param  int $attribute | ||||
|      * @param  mixed $value | ||||
|      * @return bool TRUE on success or FALSE on failure. | ||||
|      */ | ||||
|     public function setAttribute($attribute, $value) | ||||
|     { | ||||
|         return $this->pdo->setAttribute($attribute, $value); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Profiles a call to a PDO method | ||||
|      * | ||||
|      * @param  string $method | ||||
|      * @param  string $sql | ||||
|      * @param  array  $args | ||||
|      * @return mixed  The result of the call | ||||
|      */ | ||||
|     protected function profileCall($method, $sql, array $args) | ||||
|     { | ||||
|         $trace = new TracedStatement($sql); | ||||
|         $trace->start(); | ||||
|  | ||||
|         $ex = null; | ||||
|         try { | ||||
|             $result = $this->__call($method, $args); | ||||
|         } catch (PDOException $e) { | ||||
|             $ex = $e; | ||||
|         } | ||||
|  | ||||
|         if ($this->pdo->getAttribute(PDO::ATTR_ERRMODE) !== PDO::ERRMODE_EXCEPTION && $result === false) { | ||||
|             $error = $this->pdo->errorInfo(); | ||||
|             $ex = new PDOException($error[2], $error[0]); | ||||
|         } | ||||
|  | ||||
|         $trace->end($ex); | ||||
|         $this->addExecutedStatement($trace); | ||||
|  | ||||
|         if ($this->pdo->getAttribute(PDO::ATTR_ERRMODE) === PDO::ERRMODE_EXCEPTION && $ex !== null) { | ||||
|             throw $ex; | ||||
|         } | ||||
|         return $result; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Adds an executed TracedStatement | ||||
|      * | ||||
|      * @param TracedStatement $stmt | ||||
|      */ | ||||
|     public function addExecutedStatement(TracedStatement $stmt) | ||||
|     { | ||||
|         $this->executedStatements[] = $stmt; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the accumulated execution time of statements | ||||
|      * | ||||
|      * @return int | ||||
|      */ | ||||
|     public function getAccumulatedStatementsDuration() | ||||
|     { | ||||
|         return array_reduce($this->executedStatements, function ($v, $s) { return $v + $s->getDuration(); }); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the peak memory usage while performing statements | ||||
|      * | ||||
|      * @return int | ||||
|      */ | ||||
|     public function getMemoryUsage() | ||||
|     { | ||||
|         return array_reduce($this->executedStatements, function ($v, $s) { return $v + $s->getMemoryUsage(); }); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the peak memory usage while performing statements | ||||
|      * | ||||
|      * @return int | ||||
|      */ | ||||
|     public function getPeakMemoryUsage() | ||||
|     { | ||||
|         return array_reduce($this->executedStatements, function ($v, $s) { $m = $s->getEndMemory(); return $m > $v ? $m : $v; }); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the list of executed statements as TracedStatement objects | ||||
|      * | ||||
|      * @return TracedStatement[] | ||||
|      */ | ||||
|     public function getExecutedStatements() | ||||
|     { | ||||
|         return $this->executedStatements; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the list of failed statements | ||||
|      * | ||||
|      * @return TracedStatement[] | ||||
|      */ | ||||
|     public function getFailedExecutedStatements() | ||||
|     { | ||||
|         return array_filter($this->executedStatements, function ($s) { return !$s->isSuccess(); }); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param $name | ||||
|      * @return mixed | ||||
|      */ | ||||
|     public function __get($name) | ||||
|     { | ||||
|         return $this->pdo->$name; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param $name | ||||
|      * @param $value | ||||
|      */ | ||||
|     public function __set($name, $value) | ||||
|     { | ||||
|         $this->pdo->$name = $value; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param $name | ||||
|      * @param $args | ||||
|      * @return mixed | ||||
|      */ | ||||
|     public function __call($name, $args) | ||||
|     { | ||||
|         return call_user_func_array([$this->pdo, $name], $args); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										130
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/PDO/TraceablePDOStatement.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										130
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/PDO/TraceablePDOStatement.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,130 @@ | ||||
| <?php | ||||
|  | ||||
| namespace DebugBar\DataCollector\PDO; | ||||
|  | ||||
| use PDO; | ||||
| use PDOException; | ||||
| use PDOStatement; | ||||
|  | ||||
| /** | ||||
|  * A traceable PDO statement to use with Traceablepdo | ||||
|  */ | ||||
| class TraceablePDOStatement extends PDOStatement | ||||
| { | ||||
|     /** @var PDO */ | ||||
|     protected $pdo; | ||||
|  | ||||
|     /** @var array */ | ||||
|     protected $boundParameters = []; | ||||
|  | ||||
|     /** | ||||
|      * TraceablePDOStatement constructor. | ||||
|      * | ||||
|      * @param TraceablePDO $pdo | ||||
|      */ | ||||
|     protected function __construct(TraceablePDO $pdo) | ||||
|     { | ||||
|         $this->pdo = $pdo; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Bind a column to a PHP variable | ||||
|      * | ||||
|      * @link   http://php.net/manual/en/pdostatement.bindcolumn.php | ||||
|      * @param  mixed $column Number of the column (1-indexed) or name of the column in the result set | ||||
|      * @param  mixed $param  Name of the PHP variable to which the column will be bound. | ||||
|      * @param  int   $type [optional] Data type of the parameter, specified by the PDO::PARAM_* | ||||
|      * constants. | ||||
|      * @param  int   $maxlen [optional] A hint for pre-allocation. | ||||
|      * @param  mixed $driverdata [optional] Optional parameter(s) for the driver. | ||||
|      * @return bool  TRUE on success or FALSE on failure. | ||||
|      */ | ||||
|     public function bindColumn($column, &$param, $type = null, $maxlen = null, $driverdata = null) | ||||
|     { | ||||
|         $this->boundParameters[$column] = $param; | ||||
|         $args = array_merge([$column, &$param], array_slice(func_get_args(), 2)); | ||||
|         return call_user_func_array(['parent', 'bindColumn'], $args); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Binds a parameter to the specified variable name | ||||
|      * | ||||
|      * @link   http://php.net/manual/en/pdostatement.bindparam.php | ||||
|      * @param  mixed $parameter Parameter identifier. For a prepared statement using named | ||||
|      * placeholders, this will be a parameter name of the form :name. For a prepared statement using | ||||
|      * question mark placeholders, this will be the 1-indexed position of the parameter. | ||||
|      * @param  mixed $variable  Name of the PHP variable to bind to the SQL statement parameter. | ||||
|      * @param  int $data_type [optional] Explicit data type for the parameter using the PDO::PARAM_* | ||||
|      * constants. | ||||
|      * @param  int $length [optional] Length of the data type. To indicate that a parameter is an OUT | ||||
|      * parameter from a stored procedure, you must explicitly set the length. | ||||
|      * @param  mixed $driver_options [optional] | ||||
|      * @return bool TRUE on success or FALSE on failure. | ||||
|      */ | ||||
|     public function bindParam($parameter, &$variable, $data_type = PDO::PARAM_STR, $length = null, $driver_options = null) | ||||
|     { | ||||
|         $this->boundParameters[$parameter] = $variable; | ||||
|         $args = array_merge([$parameter, &$variable], array_slice(func_get_args(), 2)); | ||||
|         return call_user_func_array(['parent', 'bindParam'], $args); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Binds a value to a parameter | ||||
|      * | ||||
|      * @link   http://php.net/manual/en/pdostatement.bindvalue.php | ||||
|      * @param  mixed $parameter Parameter identifier. For a prepared statement using named | ||||
|      * placeholders, this will be a parameter name of the form :name. For a prepared statement using | ||||
|      * question mark placeholders, this will be the 1-indexed position of the parameter. | ||||
|      * @param  mixed $value The value to bind to the parameter. | ||||
|      * @param  int   $data_type [optional] Explicit data type for the parameter using the PDO::PARAM_* | ||||
|      * constants. | ||||
|      * @return bool TRUE on success or FALSE on failure. | ||||
|      */ | ||||
|     public function bindValue($parameter, $value, $data_type = PDO::PARAM_STR) | ||||
|     { | ||||
|         $this->boundParameters[$parameter] = $value; | ||||
|         return call_user_func_array(['parent', 'bindValue'], func_get_args()); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Executes a prepared statement | ||||
|      * | ||||
|      * @link   http://php.net/manual/en/pdostatement.execute.php | ||||
|      * @param  array $input_parameters [optional] An array of values with as many elements as there | ||||
|      * are bound parameters in the SQL statement being executed. All values are treated as | ||||
|      * PDO::PARAM_STR. | ||||
|      * @throws PDOException | ||||
|      * @return bool TRUE on success or FALSE on failure. | ||||
|      */ | ||||
|     public function execute($input_parameters = null) | ||||
|     { | ||||
|         $preparedId = spl_object_hash($this); | ||||
|         $boundParameters = $this->boundParameters; | ||||
|         if (is_array($input_parameters)) { | ||||
|             $boundParameters = array_merge($boundParameters, $input_parameters); | ||||
|         } | ||||
|  | ||||
|         $trace = new TracedStatement($this->queryString, $boundParameters, $preparedId); | ||||
|         $trace->start(); | ||||
|  | ||||
|         $ex = null; | ||||
|         try { | ||||
|             $result = parent::execute($input_parameters); | ||||
|         } catch (PDOException $e) { | ||||
|             $ex = $e; | ||||
|         } | ||||
|  | ||||
|         if ($this->pdo->getAttribute(PDO::ATTR_ERRMODE) !== PDO::ERRMODE_EXCEPTION && $result === false) { | ||||
|             $error = $this->errorInfo(); | ||||
|             $ex = new PDOException($error[2], (int) $error[0]); | ||||
|         } | ||||
|  | ||||
|         $trace->end($ex, $this->rowCount()); | ||||
|         $this->pdo->addExecutedStatement($trace); | ||||
|  | ||||
|         if ($this->pdo->getAttribute(PDO::ATTR_ERRMODE) === PDO::ERRMODE_EXCEPTION && $ex !== null) { | ||||
|             throw $ex; | ||||
|         } | ||||
|         return $result; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										271
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/PDO/TracedStatement.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										271
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/PDO/TracedStatement.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,271 @@ | ||||
| <?php | ||||
|  | ||||
| namespace DebugBar\DataCollector\PDO; | ||||
|  | ||||
| /** | ||||
|  * Holds information about a statement | ||||
|  */ | ||||
| class TracedStatement | ||||
| { | ||||
|     protected $sql; | ||||
|  | ||||
|     protected $rowCount; | ||||
|  | ||||
|     protected $parameters; | ||||
|  | ||||
|     protected $startTime; | ||||
|  | ||||
|     protected $endTime; | ||||
|  | ||||
|     protected $duration; | ||||
|  | ||||
|     protected $startMemory; | ||||
|  | ||||
|     protected $endMemory; | ||||
|  | ||||
|     protected $memoryDelta; | ||||
|  | ||||
|     protected $exception; | ||||
|  | ||||
|     /** | ||||
|      * @param string $sql | ||||
|      * @param array $params | ||||
|      * @param string $preparedId | ||||
|      */ | ||||
|     public function __construct($sql, array $params = [], $preparedId = null) | ||||
|     { | ||||
|         $this->sql = $sql; | ||||
|         $this->parameters = $this->checkParameters($params); | ||||
|         $this->preparedId = $preparedId; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param null $startTime | ||||
|      * @param null $startMemory | ||||
|      */ | ||||
|     public function start($startTime = null, $startMemory = null) | ||||
|     { | ||||
|         $this->startTime = $startTime ?: microtime(true); | ||||
|         $this->startMemory = $startMemory ?: memory_get_usage(false); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param \Exception|null $exception | ||||
|      * @param int $rowCount | ||||
|      * @param float $endTime | ||||
|      * @param int $endMemory | ||||
|      */ | ||||
|     public function end(\Exception $exception = null, $rowCount = 0, $endTime = null, $endMemory = null) | ||||
|     { | ||||
|         $this->endTime = $endTime ?: microtime(true); | ||||
|         $this->duration = $this->endTime - $this->startTime; | ||||
|         $this->endMemory = $endMemory ?: memory_get_usage(false); | ||||
|         $this->memoryDelta = $this->endMemory - $this->startMemory; | ||||
|         $this->exception = $exception; | ||||
|         $this->rowCount = $rowCount; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Check parameters for illegal (non UTF-8) strings, like Binary data. | ||||
|      * | ||||
|      * @param array $params | ||||
|      * @return array | ||||
|      */ | ||||
|     public function checkParameters($params) | ||||
|     { | ||||
|         foreach ($params as &$param) { | ||||
|             if (!mb_check_encoding($param, 'UTF-8')) { | ||||
|                 $param = '[BINARY DATA]'; | ||||
|             } | ||||
|         } | ||||
|         return $params; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the SQL string used for the query, without filled parameters | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getSql() | ||||
|     { | ||||
|         return $this->sql; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the SQL string with any parameters used embedded | ||||
|      * | ||||
|      * @param string $quotationChar | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getSqlWithParams($quotationChar = '<>') | ||||
|     { | ||||
|         if (($l = strlen($quotationChar)) > 1) { | ||||
|             $quoteLeft = substr($quotationChar, 0, $l / 2); | ||||
|             $quoteRight = substr($quotationChar, $l / 2); | ||||
|         } else { | ||||
|             $quoteLeft = $quoteRight = $quotationChar; | ||||
|         } | ||||
|  | ||||
|         $sql = $this->sql; | ||||
|  | ||||
|         $cleanBackRefCharMap = ['%' => '%%', '$' => '$%', '\\' => '\\%']; | ||||
|  | ||||
|         foreach ($this->parameters as $k => $v) { | ||||
|  | ||||
|             $backRefSafeV = strtr($v, $cleanBackRefCharMap); | ||||
|  | ||||
|             $v = "$quoteLeft$backRefSafeV$quoteRight"; | ||||
|  | ||||
|             if (is_numeric($k)) { | ||||
|                 $marker = "\?"; | ||||
|             } else { | ||||
|                 $marker = (preg_match("/^:/", $k)) ? $k : ":" . $k; | ||||
|             } | ||||
|  | ||||
|             $matchRule = "/({$marker}(?!\w))(?=(?:[^$quotationChar]|[$quotationChar][^$quotationChar]*[$quotationChar])*$)/"; | ||||
|             for ($i = 0; $i <= mb_substr_count($sql, $k); $i++) { | ||||
|                 $sql = preg_replace($matchRule, $v, $sql, 1); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         $sql = strtr($sql, array_flip($cleanBackRefCharMap)); | ||||
|  | ||||
|         return $sql; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the number of rows affected/returned | ||||
|      * | ||||
|      * @return int | ||||
|      */ | ||||
|     public function getRowCount() | ||||
|     { | ||||
|         return $this->rowCount; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns an array of parameters used with the query | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getParameters() | ||||
|     { | ||||
|         $params = []; | ||||
|         foreach ($this->parameters as $name => $param) { | ||||
|             $params[$name] = htmlentities($param, ENT_QUOTES, 'UTF-8', false); | ||||
|         } | ||||
|         return $params; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the prepared statement id | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getPreparedId() | ||||
|     { | ||||
|         return $this->preparedId; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Checks if this is a prepared statement | ||||
|      * | ||||
|      * @return boolean | ||||
|      */ | ||||
|     public function isPrepared() | ||||
|     { | ||||
|         return $this->preparedId !== null; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return float | ||||
|      */ | ||||
|     public function getStartTime() | ||||
|     { | ||||
|         return $this->startTime; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return float | ||||
|      */ | ||||
|     public function getEndTime() | ||||
|     { | ||||
|         return $this->endTime; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the duration in seconds + microseconds of the execution | ||||
|      * | ||||
|      * @return float | ||||
|      */ | ||||
|     public function getDuration() | ||||
|     { | ||||
|         return $this->duration; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return int | ||||
|      */ | ||||
|     public function getStartMemory() | ||||
|     { | ||||
|         return $this->startMemory; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return int | ||||
|      */ | ||||
|     public function getEndMemory() | ||||
|     { | ||||
|         return $this->endMemory; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the memory usage during the execution | ||||
|      * | ||||
|      * @return int | ||||
|      */ | ||||
|     public function getMemoryUsage() | ||||
|     { | ||||
|         return $this->memoryDelta; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Checks if the statement was successful | ||||
|      * | ||||
|      * @return boolean | ||||
|      */ | ||||
|     public function isSuccess() | ||||
|     { | ||||
|         return $this->exception === null; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the exception triggered | ||||
|      * | ||||
|      * @return \Exception | ||||
|      */ | ||||
|     public function getException() | ||||
|     { | ||||
|         return $this->exception; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the exception's code | ||||
|      * | ||||
|      * @return int|string | ||||
|      */ | ||||
|     public function getErrorCode() | ||||
|     { | ||||
|         return $this->exception !== null ? $this->exception->getCode() : 0; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the exception's message | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getErrorMessage() | ||||
|     { | ||||
|         return $this->exception !== null ? $this->exception->getMessage() : ''; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										51
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/PhpInfoCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/PhpInfoCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,51 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\DataCollector; | ||||
|  | ||||
| /** | ||||
|  * Collects info about PHP | ||||
|  */ | ||||
| class PhpInfoCollector extends DataCollector implements Renderable | ||||
| { | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getName() | ||||
|     { | ||||
|         return 'php'; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function collect() | ||||
|     { | ||||
|         return array( | ||||
|             'version' => implode('.', [PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION]), | ||||
|             'interface' => PHP_SAPI | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritDoc} | ||||
|      */ | ||||
|     public function getWidgets() | ||||
|     { | ||||
|         return array( | ||||
|             "php_version" => array( | ||||
|                 "icon" => "code", | ||||
|                 "tooltip" => "Version", | ||||
|                 "map" => "php.version", | ||||
|                 "default" => "" | ||||
|             ), | ||||
|         ); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										25
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/Renderable.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/Renderable.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\DataCollector; | ||||
|  | ||||
| /** | ||||
|  * Indicates that a DataCollector is renderable using JavascriptRenderer | ||||
|  */ | ||||
| interface Renderable | ||||
| { | ||||
|     /** | ||||
|      * Returns a hash where keys are control names and their values | ||||
|      * an array of options as defined in {@see DebugBar\JavascriptRenderer::addControl()} | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     function getWidgets(); | ||||
| } | ||||
							
								
								
									
										100
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/RequestDataCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										100
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/RequestDataCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,100 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\DataCollector; | ||||
|  | ||||
| /** | ||||
|  * Collects info about the current request | ||||
|  */ | ||||
| class RequestDataCollector extends DataCollector implements Renderable, AssetProvider | ||||
| { | ||||
|     // The HTML var dumper requires debug bar users to support the new inline assets, which not all | ||||
|     // may support yet - so return false by default for now. | ||||
|     protected $useHtmlVarDumper = false; | ||||
|  | ||||
|     /** | ||||
|      * Sets a flag indicating whether the Symfony HtmlDumper will be used to dump variables for | ||||
|      * rich variable rendering. | ||||
|      * | ||||
|      * @param bool $value | ||||
|      * @return $this | ||||
|      */ | ||||
|     public function useHtmlVarDumper($value = true) | ||||
|     { | ||||
|         $this->useHtmlVarDumper = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Indicates whether the Symfony HtmlDumper will be used to dump variables for rich variable | ||||
|      * rendering. | ||||
|      * | ||||
|      * @return mixed | ||||
|      */ | ||||
|     public function isHtmlVarDumperUsed() | ||||
|     { | ||||
|         return $this->useHtmlVarDumper; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function collect() | ||||
|     { | ||||
|         $vars = array('_GET', '_POST', '_SESSION', '_COOKIE', '_SERVER'); | ||||
|         $data = array(); | ||||
|  | ||||
|         foreach ($vars as $var) { | ||||
|             if (isset($GLOBALS[$var])) { | ||||
|                 $key = "$" . $var; | ||||
|                 if ($this->isHtmlVarDumperUsed()) { | ||||
|                     $data[$key] = $this->getVarDumper()->renderVar($GLOBALS[$var]); | ||||
|                 } else { | ||||
|                     $data[$key] = $this->getDataFormatter()->formatVar($GLOBALS[$var]); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return $data; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getName() | ||||
|     { | ||||
|         return 'request'; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getAssets() { | ||||
|         return $this->isHtmlVarDumperUsed() ? $this->getVarDumper()->getAssets() : array(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getWidgets() | ||||
|     { | ||||
|         $widget = $this->isHtmlVarDumperUsed() | ||||
|             ? "PhpDebugBar.Widgets.HtmlVariableListWidget" | ||||
|             : "PhpDebugBar.Widgets.VariableListWidget"; | ||||
|         return array( | ||||
|             "request" => array( | ||||
|                 "icon" => "tags", | ||||
|                 "widget" => $widget, | ||||
|                 "map" => "request", | ||||
|                 "default" => "{}" | ||||
|             ) | ||||
|         ); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										247
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/TimeDataCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										247
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataCollector/TimeDataCollector.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,247 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\DataCollector; | ||||
|  | ||||
| use DebugBar\DebugBarException; | ||||
|  | ||||
| /** | ||||
|  * Collects info about the request duration as well as providing | ||||
|  * a way to log duration of any operations | ||||
|  */ | ||||
| class TimeDataCollector extends DataCollector implements Renderable | ||||
| { | ||||
|     /** | ||||
|      * @var float | ||||
|      */ | ||||
|     protected $requestStartTime; | ||||
|  | ||||
|     /** | ||||
|      * @var float | ||||
|      */ | ||||
|     protected $requestEndTime; | ||||
|  | ||||
|     /** | ||||
|      * @var array | ||||
|      */ | ||||
|     protected $startedMeasures = array(); | ||||
|  | ||||
|     /** | ||||
|      * @var array | ||||
|      */ | ||||
|     protected $measures = array(); | ||||
|  | ||||
|     /** | ||||
|      * @param float $requestStartTime | ||||
|      */ | ||||
|     public function __construct($requestStartTime = null) | ||||
|     { | ||||
|         if ($requestStartTime === null) { | ||||
|             if (isset($_SERVER['REQUEST_TIME_FLOAT'])) { | ||||
|                 $requestStartTime = $_SERVER['REQUEST_TIME_FLOAT']; | ||||
|             } else { | ||||
|                 $requestStartTime = microtime(true); | ||||
|             } | ||||
|         } | ||||
|         $this->requestStartTime = (float)$requestStartTime; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Starts a measure | ||||
|      * | ||||
|      * @param string $name Internal name, used to stop the measure | ||||
|      * @param string|null $label Public name | ||||
|      * @param string|null $collector The source of the collector | ||||
|      */ | ||||
|     public function startMeasure($name, $label = null, $collector = null) | ||||
|     { | ||||
|         $start = microtime(true); | ||||
|         $this->startedMeasures[$name] = array( | ||||
|             'label' => $label ?: $name, | ||||
|             'start' => $start, | ||||
|             'collector' => $collector | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Check a measure exists | ||||
|      * | ||||
|      * @param string $name | ||||
|      * @return bool | ||||
|      */ | ||||
|     public function hasStartedMeasure($name) | ||||
|     { | ||||
|         return isset($this->startedMeasures[$name]); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Stops a measure | ||||
|      * | ||||
|      * @param string $name | ||||
|      * @param array $params | ||||
|      * @throws DebugBarException | ||||
|      */ | ||||
|     public function stopMeasure($name, $params = array()) | ||||
|     { | ||||
|         $end = microtime(true); | ||||
|         if (!$this->hasStartedMeasure($name)) { | ||||
|             throw new DebugBarException("Failed stopping measure '$name' because it hasn't been started"); | ||||
|         } | ||||
|         $this->addMeasure( | ||||
|             $this->startedMeasures[$name]['label'], | ||||
|             $this->startedMeasures[$name]['start'], | ||||
|             $end, | ||||
|             $params, | ||||
|             $this->startedMeasures[$name]['collector'] | ||||
|         ); | ||||
|         unset($this->startedMeasures[$name]); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Adds a measure | ||||
|      * | ||||
|      * @param string $label | ||||
|      * @param float $start | ||||
|      * @param float $end | ||||
|      * @param array $params | ||||
|      * @param string|null $collector | ||||
|      */ | ||||
|     public function addMeasure($label, $start, $end, $params = array(), $collector = null) | ||||
|     { | ||||
|         $this->measures[] = array( | ||||
|             'label' => $label, | ||||
|             'start' => $start, | ||||
|             'relative_start' => $start - $this->requestStartTime, | ||||
|             'end' => $end, | ||||
|             'relative_end' => $end - $this->requestEndTime, | ||||
|             'duration' => $end - $start, | ||||
|             'duration_str' => $this->getDataFormatter()->formatDuration($end - $start), | ||||
|             'params' => $params, | ||||
|             'collector' => $collector | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Utility function to measure the execution of a Closure | ||||
|      * | ||||
|      * @param string $label | ||||
|      * @param \Closure $closure | ||||
|      * @param string|null $collector | ||||
|      * @return mixed | ||||
|      */ | ||||
|     public function measure($label, \Closure $closure, $collector = null) | ||||
|     { | ||||
|         $name = spl_object_hash($closure); | ||||
|         $this->startMeasure($name, $label, $collector); | ||||
|         $result = $closure(); | ||||
|         $params = is_array($result) ? $result : array(); | ||||
|         $this->stopMeasure($name, $params); | ||||
|         return $result; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns an array of all measures | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getMeasures() | ||||
|     { | ||||
|         return $this->measures; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the request start time | ||||
|      * | ||||
|      * @return float | ||||
|      */ | ||||
|     public function getRequestStartTime() | ||||
|     { | ||||
|         return $this->requestStartTime; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the request end time | ||||
|      * | ||||
|      * @return float | ||||
|      */ | ||||
|     public function getRequestEndTime() | ||||
|     { | ||||
|         return $this->requestEndTime; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the duration of a request | ||||
|      * | ||||
|      * @return float | ||||
|      */ | ||||
|     public function getRequestDuration() | ||||
|     { | ||||
|         if ($this->requestEndTime !== null) { | ||||
|             return $this->requestEndTime - $this->requestStartTime; | ||||
|         } | ||||
|         return microtime(true) - $this->requestStartTime; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      * @throws DebugBarException | ||||
|      */ | ||||
|     public function collect() | ||||
|     { | ||||
|         $this->requestEndTime = microtime(true); | ||||
|         foreach (array_keys($this->startedMeasures) as $name) { | ||||
|             $this->stopMeasure($name); | ||||
|         } | ||||
|  | ||||
|         usort($this->measures, function($a, $b) { | ||||
|             if ($a['start'] == $b['start']) { | ||||
|                 return 0; | ||||
|             } | ||||
|             return $a['start'] < $b['start'] ? -1 : 1; | ||||
|         }); | ||||
|  | ||||
|         return array( | ||||
|             'start' => $this->requestStartTime, | ||||
|             'end' => $this->requestEndTime, | ||||
|             'duration' => $this->getRequestDuration(), | ||||
|             'duration_str' => $this->getDataFormatter()->formatDuration($this->getRequestDuration()), | ||||
|             'measures' => array_values($this->measures) | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getName() | ||||
|     { | ||||
|         return 'time'; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getWidgets() | ||||
|     { | ||||
|         return array( | ||||
|             "time" => array( | ||||
|                 "icon" => "clock-o", | ||||
|                 "tooltip" => "Request Duration", | ||||
|                 "map" => "time.duration_str", | ||||
|                 "default" => "'0ms'" | ||||
|             ), | ||||
|             "timeline" => array( | ||||
|                 "icon" => "tasks", | ||||
|                 "widget" => "PhpDebugBar.Widgets.TimelineWidget", | ||||
|                 "map" => "time", | ||||
|                 "default" => "{}" | ||||
|             ) | ||||
|         ); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										83
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataFormatter/DataFormatter.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataFormatter/DataFormatter.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,83 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\DataFormatter; | ||||
|  | ||||
| use Symfony\Component\VarDumper\Cloner\VarCloner; | ||||
| use Symfony\Component\VarDumper\Dumper\CliDumper; | ||||
|  | ||||
| class DataFormatter implements DataFormatterInterface | ||||
| { | ||||
|     /** | ||||
|      * DataFormatter constructor. | ||||
|      */ | ||||
|     public function __construct() | ||||
|     { | ||||
|         $this->cloner = new VarCloner(); | ||||
|         $this->dumper = new CliDumper(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param $data | ||||
|      * @return string | ||||
|      */ | ||||
|     public function formatVar($data) | ||||
|     { | ||||
|         $output = ''; | ||||
|  | ||||
|         $this->dumper->dump( | ||||
|             $this->cloner->cloneVar($data), | ||||
|             function ($line, $depth) use (&$output) { | ||||
|                 // A negative depth means "end of dump" | ||||
|                 if ($depth >= 0) { | ||||
|                     // Adds a two spaces indentation to the line | ||||
|                     $output .= str_repeat('  ', $depth).$line."\n"; | ||||
|                 } | ||||
|             } | ||||
|         ); | ||||
|  | ||||
|         return trim($output); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param float $seconds | ||||
|      * @return string | ||||
|      */ | ||||
|     public function formatDuration($seconds) | ||||
|     { | ||||
|         if ($seconds < 0.001) { | ||||
|             return round($seconds * 1000000) . 'μs'; | ||||
|         } elseif ($seconds < 0.1) { | ||||
|             return round($seconds * 1000, 2) . 'ms'; | ||||
|         } elseif ($seconds < 1) { | ||||
|             return round($seconds * 1000) . 'ms'; | ||||
|         } | ||||
|         return round($seconds, 2) . 's'; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param string $size | ||||
|      * @param int $precision | ||||
|      * @return string | ||||
|      */ | ||||
|     public function formatBytes($size, $precision = 2) | ||||
|     { | ||||
|         if ($size === 0 || $size === null) { | ||||
|             return "0B"; | ||||
|         } | ||||
|  | ||||
|         $sign = $size < 0 ? '-' : ''; | ||||
|         $size = abs($size); | ||||
|  | ||||
|         $base = log($size) / log(1024); | ||||
|         $suffixes = array('B', 'KB', 'MB', 'GB', 'TB'); | ||||
|         return $sign . round(pow(1024, $base - floor($base)), $precision) . $suffixes[(int) floor($base)]; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										42
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataFormatter/DataFormatterInterface.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataFormatter/DataFormatterInterface.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\DataFormatter; | ||||
|  | ||||
| /** | ||||
|  * Formats data to be outputed as string | ||||
|  */ | ||||
| interface DataFormatterInterface | ||||
| { | ||||
|     /** | ||||
|      * Transforms a PHP variable to a string representation | ||||
|      * | ||||
|      * @param mixed $data | ||||
|      * @return string | ||||
|      */ | ||||
|     function formatVar($data); | ||||
|  | ||||
|     /** | ||||
|      * Transforms a duration in seconds in a readable string | ||||
|      * | ||||
|      * @param float $seconds | ||||
|      * @return string | ||||
|      */ | ||||
|     function formatDuration($seconds); | ||||
|  | ||||
|     /** | ||||
|      * Transforms a size in bytes to a human readable string | ||||
|      * | ||||
|      * @param string $size | ||||
|      * @param integer $precision | ||||
|      * @return string | ||||
|      */ | ||||
|     function formatBytes($size, $precision = 2); | ||||
| } | ||||
							
								
								
									
										315
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataFormatter/DebugBarVarDumper.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										315
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataFormatter/DebugBarVarDumper.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,315 @@ | ||||
| <?php | ||||
|  | ||||
| namespace DebugBar\DataFormatter; | ||||
|  | ||||
| use DebugBar\DataCollector\AssetProvider; | ||||
| use DebugBar\DataFormatter\VarDumper\DebugBarHtmlDumper; | ||||
| use DebugBar\DataFormatter\VarDumper\SeekingData; | ||||
| use Symfony\Component\VarDumper\Cloner\Data; | ||||
| use Symfony\Component\VarDumper\Cloner\VarCloner; | ||||
|  | ||||
| /** | ||||
|  * Clones and renders variables in HTML format using the Symfony VarDumper component. | ||||
|  * | ||||
|  * Cloning is decoupled from rendering, so that dumper users can have the fastest possible cloning | ||||
|  * performance, while delaying rendering until it is actually needed. | ||||
|  */ | ||||
| class DebugBarVarDumper implements AssetProvider | ||||
| { | ||||
|     protected static $defaultClonerOptions = array(); | ||||
|  | ||||
|     protected static $defaultDumperOptions = array( | ||||
|         'expanded_depth' => 0, | ||||
|         'styles' => array( | ||||
|             // NOTE:  'default' CSS is also specified in debugbar.css | ||||
|             'default' => 'word-wrap: break-word; white-space: pre-wrap; word-break: normal', | ||||
|             'num' => 'font-weight:bold; color:#1299DA', | ||||
|             'const' => 'font-weight:bold', | ||||
|             'str' => 'font-weight:bold; color:#3A9B26', | ||||
|             'note' => 'color:#1299DA', | ||||
|             'ref' => 'color:#7B7B7B', | ||||
|             'public' => 'color:#000000', | ||||
|             'protected' => 'color:#000000', | ||||
|             'private' => 'color:#000000', | ||||
|             'meta' => 'color:#B729D9', | ||||
|             'key' => 'color:#3A9B26', | ||||
|             'index' => 'color:#1299DA', | ||||
|             'ellipsis' => 'color:#A0A000', | ||||
|         ), | ||||
|     ); | ||||
|  | ||||
|     protected $clonerOptions; | ||||
|  | ||||
|     protected $dumperOptions; | ||||
|  | ||||
|     /** @var VarCloner */ | ||||
|     protected $cloner; | ||||
|  | ||||
|     /** @var DebugBarHtmlDumper */ | ||||
|     protected $dumper; | ||||
|  | ||||
|     /** | ||||
|      * Gets the VarCloner instance with configuration options set. | ||||
|      * | ||||
|      * @return VarCloner | ||||
|      */ | ||||
|     protected function getCloner() | ||||
|     { | ||||
|         if (!$this->cloner) { | ||||
|             $clonerOptions = $this->getClonerOptions(); | ||||
|             if (isset($clonerOptions['casters'])) { | ||||
|                 $this->cloner = new VarCloner($clonerOptions['casters']); | ||||
|             } else { | ||||
|                 $this->cloner = new VarCloner(); | ||||
|             } | ||||
|             if (isset($clonerOptions['additional_casters'])) { | ||||
|                 $this->cloner->addCasters($clonerOptions['additional_casters']); | ||||
|             } | ||||
|             if (isset($clonerOptions['max_items'])) { | ||||
|                 $this->cloner->setMaxItems($clonerOptions['max_items']); | ||||
|             } | ||||
|             if (isset($clonerOptions['max_string'])) { | ||||
|                 $this->cloner->setMaxString($clonerOptions['max_string']); | ||||
|             } | ||||
|             // setMinDepth was added to Symfony 3.4: | ||||
|             if (isset($clonerOptions['min_depth']) && method_exists($this->cloner, 'setMinDepth')) { | ||||
|                 $this->cloner->setMinDepth($clonerOptions['min_depth']); | ||||
|             } | ||||
|         } | ||||
|         return $this->cloner; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Gets the DebugBarHtmlDumper instance with configuration options set. | ||||
|      * | ||||
|      * @return DebugBarHtmlDumper | ||||
|      */ | ||||
|     protected function getDumper() | ||||
|     { | ||||
|         if (!$this->dumper) { | ||||
|             $this->dumper = new DebugBarHtmlDumper(); | ||||
|             $dumperOptions = $this->getDumperOptions(); | ||||
|             if (isset($dumperOptions['styles'])) { | ||||
|                 $this->dumper->setStyles($dumperOptions['styles']); | ||||
|             } | ||||
|         } | ||||
|         return $this->dumper; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Gets the array of non-default VarCloner configuration options. | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getClonerOptions() | ||||
|     { | ||||
|         if ($this->clonerOptions === null) { | ||||
|             $this->clonerOptions = self::$defaultClonerOptions; | ||||
|         } | ||||
|         return $this->clonerOptions; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Merges an array of non-default VarCloner configuration options with the existing non-default | ||||
|      * options. | ||||
|      * | ||||
|      * Configuration options are: | ||||
|      *  - casters: a map of VarDumper Caster objects to use instead of the default casters. | ||||
|      *  - additional_casters: a map of VarDumper Caster objects to use in addition to the default | ||||
|      *    casters. | ||||
|      *  - max_items: maximum number of items to clone beyond the minimum depth. | ||||
|      *  - max_string: maximum string size | ||||
|      *  - min_depth: minimum tree depth to clone before counting items against the max_items limit. | ||||
|      *    (Requires Symfony 3.4; ignored on older versions.) | ||||
|      * | ||||
|      * @param array $options | ||||
|      */ | ||||
|     public function mergeClonerOptions($options) | ||||
|     { | ||||
|         $this->clonerOptions = $options + $this->getClonerOptions(); | ||||
|         $this->cloner = null; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Resets the array of non-default VarCloner configuration options without retaining any of the | ||||
|      * existing non-default options. | ||||
|      * | ||||
|      * Configuration options are: | ||||
|      *  - casters: a map of VarDumper Caster objects to use instead of the default casters. | ||||
|      *  - additional_casters: a map of VarDumper Caster objects to use in addition to the default | ||||
|      *    casters. | ||||
|      *  - max_items: maximum number of items to clone beyond the minimum depth. | ||||
|      *  - max_string: maximum string size | ||||
|      *  - min_depth: minimum tree depth to clone before counting items against the max_items limit. | ||||
|      *    (Requires Symfony 3.4; ignored on older versions.) | ||||
|      * | ||||
|      * @param array $options | ||||
|      */ | ||||
|     public function resetClonerOptions($options = null) | ||||
|     { | ||||
|         $this->clonerOptions = ($options ?: array()) + self::$defaultClonerOptions; | ||||
|         $this->cloner = null; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Gets the array of non-default HtmlDumper configuration options. | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getDumperOptions() | ||||
|     { | ||||
|         if ($this->dumperOptions === null) { | ||||
|             $this->dumperOptions = self::$defaultDumperOptions; | ||||
|         } | ||||
|         return $this->dumperOptions; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Merges an array of non-default HtmlDumper configuration options with the existing non-default | ||||
|      * options. | ||||
|      * | ||||
|      * Configuration options are: | ||||
|      *  - styles: a map of CSS styles to include in the assets, as documented in | ||||
|      *    HtmlDumper::setStyles. | ||||
|      *  - expanded_depth: the tree depth to initially expand. | ||||
|      *    (Requires Symfony 3.2; ignored on older versions.) | ||||
|      *  - max_string: maximum string size. | ||||
|      *    (Requires Symfony 3.2; ignored on older versions.) | ||||
|      *  - file_link_format: link format for files; %f expanded to file and %l expanded to line | ||||
|      *    (Requires Symfony 3.2; ignored on older versions.) | ||||
|      * | ||||
|      * @param array $options | ||||
|      */ | ||||
|     public function mergeDumperOptions($options) | ||||
|     { | ||||
|         $this->dumperOptions = $options + $this->getDumperOptions(); | ||||
|         $this->dumper = null; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Resets the array of non-default HtmlDumper configuration options without retaining any of the | ||||
|      * existing non-default options. | ||||
|      * | ||||
|      * Configuration options are: | ||||
|      *  - styles: a map of CSS styles to include in the assets, as documented in | ||||
|      *    HtmlDumper::setStyles. | ||||
|      *  - expanded_depth: the tree depth to initially expand. | ||||
|      *    (Requires Symfony 3.2; ignored on older versions.) | ||||
|      *  - max_string: maximum string size. | ||||
|      *    (Requires Symfony 3.2; ignored on older versions.) | ||||
|      *  - file_link_format: link format for files; %f expanded to file and %l expanded to line | ||||
|      *    (Requires Symfony 3.2; ignored on older versions.) | ||||
|      * | ||||
|      * @param array $options | ||||
|      */ | ||||
|     public function resetDumperOptions($options = null) | ||||
|     { | ||||
|         $this->dumperOptions = ($options ?: array()) + self::$defaultDumperOptions; | ||||
|         $this->dumper = null; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Captures the data from a variable and serializes it for later rendering. | ||||
|      * | ||||
|      * @param mixed $data The variable to capture. | ||||
|      * @return string Serialized variable data. | ||||
|      */ | ||||
|     public function captureVar($data) | ||||
|     { | ||||
|         return serialize($this->getCloner()->cloneVar($data)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Gets the display options for the HTML dumper. | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     protected function getDisplayOptions() | ||||
|     { | ||||
|         $displayOptions = array(); | ||||
|         $dumperOptions = $this->getDumperOptions(); | ||||
|         // Only used by Symfony 3.2 and newer: | ||||
|         if (isset($dumperOptions['expanded_depth'])) { | ||||
|             $displayOptions['maxDepth'] = $dumperOptions['expanded_depth']; | ||||
|         } | ||||
|         // Only used by Symfony 3.2 and newer: | ||||
|         if (isset($dumperOptions['max_string'])) { | ||||
|             $displayOptions['maxStringLength'] = $dumperOptions['max_string']; | ||||
|         } | ||||
|         // Only used by Symfony 3.2 and newer: | ||||
|         if (isset($dumperOptions['file_link_format'])) { | ||||
|             $displayOptions['fileLinkFormat'] = $dumperOptions['file_link_format']; | ||||
|         } | ||||
|         return $displayOptions; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Renders previously-captured data from captureVar to HTML and returns it as a string. | ||||
|      * | ||||
|      * @param string $capturedData Captured data from captureVar. | ||||
|      * @param array $seekPath Pass an array of keys to traverse if you only want to render a subset | ||||
|      *                        of the data. | ||||
|      * @return string HTML rendering of the variable. | ||||
|      */ | ||||
|     public function renderCapturedVar($capturedData, $seekPath = array()) | ||||
|     { | ||||
|         $data = unserialize($capturedData); | ||||
|         // The seek method was added in Symfony 3.2; emulate the behavior via SeekingData for older | ||||
|         // Symfony versions. | ||||
|         if (!method_exists($data, 'seek')) { | ||||
|             $data = new SeekingData($data->getRawData()); | ||||
|         } | ||||
|  | ||||
|         foreach ($seekPath as $key) { | ||||
|             $data = $data->seek($key); | ||||
|         } | ||||
|  | ||||
|         return $this->dump($data); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Captures and renders the data from a variable to HTML and returns it as a string. | ||||
|      * | ||||
|      * @param mixed $data The variable to capture and render. | ||||
|      * @return string HTML rendering of the variable. | ||||
|      */ | ||||
|     public function renderVar($data) | ||||
|     { | ||||
|         return $this->dump($this->getCloner()->cloneVar($data)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns assets required for rendering variables. | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getAssets() { | ||||
|         $dumper = $this->getDumper(); | ||||
|         $dumper->resetDumpHeader(); // this will cause the default dump header to regenerate | ||||
|         return array( | ||||
|             'inline_head' => array( | ||||
|                 'html_var_dumper' => $dumper->getDumpHeaderByDebugBar(), | ||||
|             ), | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Helper function to dump a Data object to HTML. | ||||
|      * | ||||
|      * @param Data $data | ||||
|      * @return string | ||||
|      */ | ||||
|     protected function dump(Data $data) | ||||
|     { | ||||
|         $dumper = $this->getDumper(); | ||||
|         $output = fopen('php://memory', 'r+b'); | ||||
|         $dumper->setOutput($output); | ||||
|         $dumper->setDumpHeader(''); // we don't actually want a dump header | ||||
|         // NOTE:  Symfony 3.2 added the third $extraDisplayOptions parameter.  Older versions will | ||||
|         // safely ignore it. | ||||
|         $dumper->dump($data, null, $this->getDisplayOptions()); | ||||
|         $result = stream_get_contents($output, -1, 0); | ||||
|         fclose($output); | ||||
|         return $result; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										25
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataFormatter/VarDumper/DebugBarHtmlDumper.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataFormatter/VarDumper/DebugBarHtmlDumper.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| <?php | ||||
|  | ||||
| namespace DebugBar\DataFormatter\VarDumper; | ||||
|  | ||||
| use Symfony\Component\VarDumper\Dumper\HtmlDumper; | ||||
|  | ||||
| /** | ||||
|  * We have to extend the base HtmlDumper class in order to get access to the protected-only | ||||
|  * getDumpHeader function. | ||||
|  */ | ||||
| class DebugBarHtmlDumper extends HtmlDumper | ||||
| { | ||||
|     /** | ||||
|      * Resets an HTML header. | ||||
|      */ | ||||
|     public function resetDumpHeader() | ||||
|     { | ||||
|         $this->dumpHeader = null; | ||||
|     } | ||||
|  | ||||
|     public function getDumpHeaderByDebugBar() { | ||||
|         // getDumpHeader is protected: | ||||
|         return str_replace('pre.sf-dump', '.phpdebugbar pre.sf-dump', $this->getDumpHeader()); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										103
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataFormatter/VarDumper/SeekingData.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										103
									
								
								vendor/maximebf/debugbar/src/DebugBar/DataFormatter/VarDumper/SeekingData.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,103 @@ | ||||
| <?php | ||||
|  | ||||
| namespace DebugBar\DataFormatter\VarDumper; | ||||
|  | ||||
| use Symfony\Component\VarDumper\Cloner\Cursor; | ||||
| use Symfony\Component\VarDumper\Cloner\Data; | ||||
| use Symfony\Component\VarDumper\Cloner\DumperInterface; | ||||
| use Symfony\Component\VarDumper\Cloner\Stub; | ||||
|  | ||||
| /** | ||||
|  * This class backports the seek() function from Symfony 3.2 to older versions - up to v2.6.  The | ||||
|  * class should not be used with newer Symfony versions that provide the seek function, as it relies | ||||
|  * on a lot of undocumented functionality. | ||||
|  */ | ||||
| class SeekingData extends Data | ||||
| { | ||||
|     // Because the class copies/pastes the seek() implementation from Symfony 3.2, we reproduce its | ||||
|     // copyright here; this class is subject to the following additional copyright: | ||||
|  | ||||
|     /* | ||||
|      * Copyright (c) 2014-2017 Fabien Potencier | ||||
|      * | ||||
|      * 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. | ||||
|      */ | ||||
|     private $position = 0; | ||||
|     private $key = 0; | ||||
|  | ||||
|     /** | ||||
|      * Seeks to a specific key in nested data structures. | ||||
|      * | ||||
|      * @param string|int $key The key to seek to | ||||
|      * | ||||
|      * @return self|null A clone of $this of null if the key is not set | ||||
|      */ | ||||
|     public function seek($key) | ||||
|     { | ||||
|         $thisData = $this->getRawData(); | ||||
|         $item = $thisData[$this->position][$this->key]; | ||||
|  | ||||
|         if (!$item instanceof Stub || !$item->position) { | ||||
|             return; | ||||
|         } | ||||
|         $keys = array($key); | ||||
|  | ||||
|         switch ($item->type) { | ||||
|             case Stub::TYPE_OBJECT: | ||||
|                 $keys[] = "\0+\0".$key; | ||||
|                 $keys[] = "\0*\0".$key; | ||||
|                 $keys[] = "\0~\0".$key; | ||||
|                 $keys[] = "\0$item->class\0$key"; | ||||
|             case Stub::TYPE_ARRAY: | ||||
|             case Stub::TYPE_RESOURCE: | ||||
|                 break; | ||||
|             default: | ||||
|                 return; | ||||
|         } | ||||
|  | ||||
|         $data = null; | ||||
|         $children = $thisData[$item->position]; | ||||
|  | ||||
|         foreach ($keys as $key) { | ||||
|             if (isset($children[$key]) || array_key_exists($key, $children)) { | ||||
|                 $data = clone $this; | ||||
|                 $data->key = $key; | ||||
|                 $data->position = $item->position; | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return $data; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|     public function dump(DumperInterface $dumper) | ||||
|     { | ||||
|         // Override the base class dump to use the position and key | ||||
|         $refs = array(0); | ||||
|         $class = new \ReflectionClass($this); | ||||
|         $dumpItem = $class->getMethod('dumpItem'); | ||||
|         $dumpItem->setAccessible(true); | ||||
|         $data = $this->getRawData(); | ||||
|         $args = array($dumper, new Cursor(), &$refs, $data[$this->position][$this->key]); | ||||
|         $dumpItem->invokeArgs($this, $args); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										497
									
								
								vendor/maximebf/debugbar/src/DebugBar/DebugBar.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										497
									
								
								vendor/maximebf/debugbar/src/DebugBar/DebugBar.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,497 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar; | ||||
|  | ||||
| use ArrayAccess; | ||||
| use DebugBar\DataCollector\DataCollectorInterface; | ||||
| use DebugBar\Storage\StorageInterface; | ||||
|  | ||||
| /** | ||||
|  * Main DebugBar object | ||||
|  * | ||||
|  * Manages data collectors. DebugBar provides an array-like access | ||||
|  * to collectors by name. | ||||
|  * | ||||
|  * <code> | ||||
|  *     $debugbar = new DebugBar(); | ||||
|  *     $debugbar->addCollector(new DataCollector\MessagesCollector()); | ||||
|  *     $debugbar['messages']->addMessage("foobar"); | ||||
|  * </code> | ||||
|  */ | ||||
| class DebugBar implements ArrayAccess | ||||
| { | ||||
|     public static $useOpenHandlerWhenSendingDataHeaders = false; | ||||
|  | ||||
|     protected $collectors = array(); | ||||
|  | ||||
|     protected $data; | ||||
|  | ||||
|     protected $jsRenderer; | ||||
|  | ||||
|     protected $requestIdGenerator; | ||||
|  | ||||
|     protected $requestId; | ||||
|  | ||||
|     protected $storage; | ||||
|  | ||||
|     protected $httpDriver; | ||||
|  | ||||
|     protected $stackSessionNamespace = 'PHPDEBUGBAR_STACK_DATA'; | ||||
|  | ||||
|     protected $stackAlwaysUseSessionStorage = false; | ||||
|  | ||||
|     /** | ||||
|      * Adds a data collector | ||||
|      * | ||||
|      * @param DataCollectorInterface $collector | ||||
|      * | ||||
|      * @throws DebugBarException | ||||
|      * @return $this | ||||
|      */ | ||||
|     public function addCollector(DataCollectorInterface $collector) | ||||
|     { | ||||
|         if ($collector->getName() === '__meta') { | ||||
|             throw new DebugBarException("'__meta' is a reserved name and cannot be used as a collector name"); | ||||
|         } | ||||
|         if (isset($this->collectors[$collector->getName()])) { | ||||
|             throw new DebugBarException("'{$collector->getName()}' is already a registered collector"); | ||||
|         } | ||||
|         $this->collectors[$collector->getName()] = $collector; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Checks if a data collector has been added | ||||
|      * | ||||
|      * @param string $name | ||||
|      * @return boolean | ||||
|      */ | ||||
|     public function hasCollector($name) | ||||
|     { | ||||
|         return isset($this->collectors[$name]); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns a data collector | ||||
|      * | ||||
|      * @param string $name | ||||
|      * @return DataCollectorInterface | ||||
|      * @throws DebugBarException | ||||
|      */ | ||||
|     public function getCollector($name) | ||||
|     { | ||||
|         if (!isset($this->collectors[$name])) { | ||||
|             throw new DebugBarException("'$name' is not a registered collector"); | ||||
|         } | ||||
|         return $this->collectors[$name]; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns an array of all data collectors | ||||
|      * | ||||
|      * @return array[DataCollectorInterface] | ||||
|      */ | ||||
|     public function getCollectors() | ||||
|     { | ||||
|         return $this->collectors; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sets the request id generator | ||||
|      * | ||||
|      * @param RequestIdGeneratorInterface $generator | ||||
|      * @return $this | ||||
|      */ | ||||
|     public function setRequestIdGenerator(RequestIdGeneratorInterface $generator) | ||||
|     { | ||||
|         $this->requestIdGenerator = $generator; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return RequestIdGeneratorInterface | ||||
|      */ | ||||
|     public function getRequestIdGenerator() | ||||
|     { | ||||
|         if ($this->requestIdGenerator === null) { | ||||
|             $this->requestIdGenerator = new RequestIdGenerator(); | ||||
|         } | ||||
|         return $this->requestIdGenerator; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the id of the current request | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getCurrentRequestId() | ||||
|     { | ||||
|         if ($this->requestId === null) { | ||||
|             $this->requestId = $this->getRequestIdGenerator()->generate(); | ||||
|         } | ||||
|         return $this->requestId; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sets the storage backend to use to store the collected data | ||||
|      * | ||||
|      * @param StorageInterface $storage | ||||
|      * @return $this | ||||
|      */ | ||||
|     public function setStorage(StorageInterface $storage = null) | ||||
|     { | ||||
|         $this->storage = $storage; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return StorageInterface | ||||
|      */ | ||||
|     public function getStorage() | ||||
|     { | ||||
|         return $this->storage; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Checks if the data will be persisted | ||||
|      * | ||||
|      * @return boolean | ||||
|      */ | ||||
|     public function isDataPersisted() | ||||
|     { | ||||
|         return $this->storage !== null; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sets the HTTP driver | ||||
|      * | ||||
|      * @param HttpDriverInterface $driver | ||||
|      * @return $this | ||||
|      */ | ||||
|     public function setHttpDriver(HttpDriverInterface $driver) | ||||
|     { | ||||
|         $this->httpDriver = $driver; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the HTTP driver | ||||
|      * | ||||
|      * If no http driver where defined, a PhpHttpDriver is automatically created | ||||
|      * | ||||
|      * @return HttpDriverInterface | ||||
|      */ | ||||
|     public function getHttpDriver() | ||||
|     { | ||||
|         if ($this->httpDriver === null) { | ||||
|             $this->httpDriver = new PhpHttpDriver(); | ||||
|         } | ||||
|         return $this->httpDriver; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Collects the data from the collectors | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     public function collect() | ||||
|     { | ||||
|         if (php_sapi_name() === 'cli') { | ||||
|             $ip = gethostname(); | ||||
|             if ($ip) { | ||||
|                 $ip = gethostbyname($ip); | ||||
|             } else { | ||||
|                 $ip = '127.0.0.1'; | ||||
|             } | ||||
|             $request_variables = array( | ||||
|                 'method' => 'CLI', | ||||
|                 'uri' => isset($_SERVER['SCRIPT_FILENAME']) ? realpath($_SERVER['SCRIPT_FILENAME']) : null, | ||||
|                 'ip' => $ip | ||||
|             ); | ||||
|         } else { | ||||
|             $request_variables = array( | ||||
|                 'method' => isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null, | ||||
|                 'uri' => isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : null, | ||||
|                 'ip' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null | ||||
|             ); | ||||
|         } | ||||
|         $this->data = array( | ||||
|             '__meta' => array_merge( | ||||
|                 array( | ||||
|                     'id' => $this->getCurrentRequestId(), | ||||
|                     'datetime' => date('Y-m-d H:i:s'), | ||||
|                     'utime' => microtime(true) | ||||
|                 ), | ||||
|                 $request_variables | ||||
|             ) | ||||
|         ); | ||||
|  | ||||
|         foreach ($this->collectors as $name => $collector) { | ||||
|             $this->data[$name] = $collector->collect(); | ||||
|         } | ||||
|  | ||||
|         // Remove all invalid (non UTF-8) characters | ||||
|         array_walk_recursive($this->data, function (&$item) { | ||||
|                 if (is_string($item) && !mb_check_encoding($item, 'UTF-8')) { | ||||
|                     $item = mb_convert_encoding($item, 'UTF-8', 'UTF-8'); | ||||
|                 } | ||||
|             }); | ||||
|  | ||||
|         if ($this->storage !== null) { | ||||
|             $this->storage->save($this->getCurrentRequestId(), $this->data); | ||||
|         } | ||||
|  | ||||
|         return $this->data; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns collected data | ||||
|      * | ||||
|      * Will collect the data if none have been collected yet | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getData() | ||||
|     { | ||||
|         if ($this->data === null) { | ||||
|             $this->collect(); | ||||
|         } | ||||
|         return $this->data; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns an array of HTTP headers containing the data | ||||
|      * | ||||
|      * @param string $headerName | ||||
|      * @param integer $maxHeaderLength | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getDataAsHeaders($headerName = 'phpdebugbar', $maxHeaderLength = 4096, $maxTotalHeaderLength = 250000) | ||||
|     { | ||||
|         $data = rawurlencode(json_encode(array( | ||||
|             'id' => $this->getCurrentRequestId(), | ||||
|             'data' => $this->getData() | ||||
|         ))); | ||||
|  | ||||
|         if (strlen($data) > $maxTotalHeaderLength) { | ||||
|             $data = rawurlencode(json_encode(array( | ||||
|                 'error' => 'Maximum header size exceeded' | ||||
|             ))); | ||||
|         } | ||||
|  | ||||
|         $chunks = array(); | ||||
|  | ||||
|         while (strlen($data) > $maxHeaderLength) { | ||||
|             $chunks[] = substr($data, 0, $maxHeaderLength); | ||||
|             $data = substr($data, $maxHeaderLength); | ||||
|         } | ||||
|         $chunks[] = $data; | ||||
|  | ||||
|         $headers = array(); | ||||
|         for ($i = 0, $c = count($chunks); $i < $c; $i++) { | ||||
|             $name = $headerName . ($i > 0 ? "-$i" : ''); | ||||
|             $headers[$name] = $chunks[$i]; | ||||
|         } | ||||
|  | ||||
|         return $headers; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sends the data through the HTTP headers | ||||
|      * | ||||
|      * @param bool $useOpenHandler | ||||
|      * @param string $headerName | ||||
|      * @param integer $maxHeaderLength | ||||
|      * @return $this | ||||
|      */ | ||||
|     public function sendDataInHeaders($useOpenHandler = null, $headerName = 'phpdebugbar', $maxHeaderLength = 4096) | ||||
|     { | ||||
|         if ($useOpenHandler === null) { | ||||
|             $useOpenHandler = self::$useOpenHandlerWhenSendingDataHeaders; | ||||
|         } | ||||
|         if ($useOpenHandler && $this->storage !== null) { | ||||
|             $this->getData(); | ||||
|             $headerName .= '-id'; | ||||
|             $headers = array($headerName => $this->getCurrentRequestId()); | ||||
|         } else { | ||||
|             $headers = $this->getDataAsHeaders($headerName, $maxHeaderLength); | ||||
|         } | ||||
|         $this->getHttpDriver()->setHeaders($headers); | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Stacks the data in the session for later rendering | ||||
|      */ | ||||
|     public function stackData() | ||||
|     { | ||||
|         $http = $this->initStackSession(); | ||||
|  | ||||
|         $data = null; | ||||
|         if (!$this->isDataPersisted() || $this->stackAlwaysUseSessionStorage) { | ||||
|             $data = $this->getData(); | ||||
|         } elseif ($this->data === null) { | ||||
|             $this->collect(); | ||||
|         } | ||||
|  | ||||
|         $stack = $http->getSessionValue($this->stackSessionNamespace); | ||||
|         $stack[$this->getCurrentRequestId()] = $data; | ||||
|         $http->setSessionValue($this->stackSessionNamespace, $stack); | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Checks if there is stacked data in the session | ||||
|      * | ||||
|      * @return boolean | ||||
|      */ | ||||
|     public function hasStackedData() | ||||
|     { | ||||
|         try { | ||||
|             $http = $this->initStackSession(); | ||||
|         } catch (DebugBarException $e) { | ||||
|             return false; | ||||
|         } | ||||
|         return count($http->getSessionValue($this->stackSessionNamespace)) > 0; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the data stacked in the session | ||||
|      * | ||||
|      * @param boolean $delete Whether to delete the data in the session | ||||
|      * @return array | ||||
|      */ | ||||
|     public function getStackedData($delete = true) | ||||
|     { | ||||
|         $http = $this->initStackSession(); | ||||
|         $stackedData = $http->getSessionValue($this->stackSessionNamespace); | ||||
|         if ($delete) { | ||||
|             $http->deleteSessionValue($this->stackSessionNamespace); | ||||
|         } | ||||
|  | ||||
|         $datasets = array(); | ||||
|         if ($this->isDataPersisted() && !$this->stackAlwaysUseSessionStorage) { | ||||
|             foreach ($stackedData as $id => $data) { | ||||
|                 $datasets[$id] = $this->getStorage()->get($id); | ||||
|             } | ||||
|         } else { | ||||
|             $datasets = $stackedData; | ||||
|         } | ||||
|  | ||||
|         return $datasets; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sets the key to use in the $_SESSION array | ||||
|      * | ||||
|      * @param string $ns | ||||
|      * @return $this | ||||
|      */ | ||||
|     public function setStackDataSessionNamespace($ns) | ||||
|     { | ||||
|         $this->stackSessionNamespace = $ns; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the key used in the $_SESSION array | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getStackDataSessionNamespace() | ||||
|     { | ||||
|         return $this->stackSessionNamespace; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sets whether to only use the session to store stacked data even | ||||
|      * if a storage is enabled | ||||
|      * | ||||
|      * @param boolean $enabled | ||||
|      * @return $this | ||||
|      */ | ||||
|     public function setStackAlwaysUseSessionStorage($enabled = true) | ||||
|     { | ||||
|         $this->stackAlwaysUseSessionStorage = $enabled; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Checks if the session is always used to store stacked data | ||||
|      * even if a storage is enabled | ||||
|      * | ||||
|      * @return boolean | ||||
|      */ | ||||
|     public function isStackAlwaysUseSessionStorage() | ||||
|     { | ||||
|         return $this->stackAlwaysUseSessionStorage; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Initializes the session for stacked data | ||||
|      * @return HttpDriverInterface | ||||
|      * @throws DebugBarException | ||||
|      */ | ||||
|     protected function initStackSession() | ||||
|     { | ||||
|         $http = $this->getHttpDriver(); | ||||
|         if (!$http->isSessionStarted()) { | ||||
|             throw new DebugBarException("Session must be started before using stack data in the debug bar"); | ||||
|         } | ||||
|  | ||||
|         if (!$http->hasSessionValue($this->stackSessionNamespace)) { | ||||
|             $http->setSessionValue($this->stackSessionNamespace, array()); | ||||
|         } | ||||
|  | ||||
|         return $http; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns a JavascriptRenderer for this instance | ||||
|      * @param string $baseUrl | ||||
|      * @param string $basePath | ||||
|      * @return JavascriptRenderer | ||||
|      */ | ||||
|     public function getJavascriptRenderer($baseUrl = null, $basePath = null) | ||||
|     { | ||||
|         if ($this->jsRenderer === null) { | ||||
|             $this->jsRenderer = new JavascriptRenderer($this, $baseUrl, $basePath); | ||||
|         } | ||||
|         return $this->jsRenderer; | ||||
|     } | ||||
|  | ||||
|     // -------------------------------------------- | ||||
|     // ArrayAccess implementation | ||||
|  | ||||
|     #[\ReturnTypeWillChange] | ||||
|     public function offsetSet($key, $value) | ||||
|     { | ||||
|         throw new DebugBarException("DebugBar[] is read-only"); | ||||
|     } | ||||
|  | ||||
|     #[\ReturnTypeWillChange] | ||||
|     public function offsetGet($key) | ||||
|     { | ||||
|         return $this->getCollector($key); | ||||
|     } | ||||
|  | ||||
|     #[\ReturnTypeWillChange] | ||||
|     public function offsetExists($key) | ||||
|     { | ||||
|         return $this->hasCollector($key); | ||||
|     } | ||||
|  | ||||
|     #[\ReturnTypeWillChange] | ||||
|     public function offsetUnset($key) | ||||
|     { | ||||
|         throw new DebugBarException("DebugBar[] is read-only"); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										16
									
								
								vendor/maximebf/debugbar/src/DebugBar/DebugBarException.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								vendor/maximebf/debugbar/src/DebugBar/DebugBarException.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar; | ||||
|  | ||||
| class DebugBarException extends \Exception | ||||
| { | ||||
|     // | ||||
| } | ||||
							
								
								
									
										64
									
								
								vendor/maximebf/debugbar/src/DebugBar/HttpDriverInterface.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								vendor/maximebf/debugbar/src/DebugBar/HttpDriverInterface.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,64 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar; | ||||
|  | ||||
| /** | ||||
|  * Provides an abstraction of PHP native features for easier integration | ||||
|  * in third party frameworks | ||||
|  */ | ||||
| interface HttpDriverInterface | ||||
| { | ||||
|     /** | ||||
|      * Sets HTTP headers | ||||
|      * | ||||
|      * @param array $headers | ||||
|      * @return | ||||
|      */ | ||||
|     function setHeaders(array $headers); | ||||
|  | ||||
|     /** | ||||
|      * Checks if the session is started | ||||
|      * | ||||
|      * @return boolean | ||||
|      */ | ||||
|     function isSessionStarted(); | ||||
|  | ||||
|     /** | ||||
|      * Sets a value in the session | ||||
|      * | ||||
|      * @param string $name | ||||
|      * @param string $value | ||||
|      */ | ||||
|     function setSessionValue($name, $value); | ||||
|  | ||||
|     /** | ||||
|      * Checks if a value is in the session | ||||
|      * | ||||
|      * @param string $name | ||||
|      * @return boolean | ||||
|      */ | ||||
|     function hasSessionValue($name); | ||||
|  | ||||
|     /** | ||||
|      * Returns a value from the session | ||||
|      * | ||||
|      * @param string $name | ||||
|      * @return mixed | ||||
|      */ | ||||
|     function getSessionValue($name); | ||||
|  | ||||
|     /** | ||||
|      * Deletes a value from the session | ||||
|      * | ||||
|      * @param string $name | ||||
|      */ | ||||
|     function deleteSessionValue($name); | ||||
| } | ||||
							
								
								
									
										1198
									
								
								vendor/maximebf/debugbar/src/DebugBar/JavascriptRenderer.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1198
									
								
								vendor/maximebf/debugbar/src/DebugBar/JavascriptRenderer.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										117
									
								
								vendor/maximebf/debugbar/src/DebugBar/OpenHandler.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										117
									
								
								vendor/maximebf/debugbar/src/DebugBar/OpenHandler.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,117 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar; | ||||
|  | ||||
| /** | ||||
|  * Handler to list and open saved dataset | ||||
|  */ | ||||
| class OpenHandler | ||||
| { | ||||
|     protected $debugBar; | ||||
|  | ||||
|     /** | ||||
|      * @param DebugBar $debugBar | ||||
|      * @throws DebugBarException | ||||
|      */ | ||||
|     public function __construct(DebugBar $debugBar) | ||||
|     { | ||||
|         if (!$debugBar->isDataPersisted()) { | ||||
|             throw new DebugBarException("DebugBar must have a storage backend to use OpenHandler"); | ||||
|         } | ||||
|         $this->debugBar = $debugBar; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Handles the current request | ||||
|      * | ||||
|      * @param array $request Request data | ||||
|      * @param bool $echo | ||||
|      * @param bool $sendHeader | ||||
|      * @return string | ||||
|      * @throws DebugBarException | ||||
|      */ | ||||
|     public function handle($request = null, $echo = true, $sendHeader = true) | ||||
|     { | ||||
|         if ($request === null) { | ||||
|             $request = $_REQUEST; | ||||
|         } | ||||
|  | ||||
|         $op = 'find'; | ||||
|         if (isset($request['op'])) { | ||||
|             $op = $request['op']; | ||||
|             if (!in_array($op, array('find', 'get', 'clear'))) { | ||||
|                 throw new DebugBarException("Invalid operation '{$request['op']}'"); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if ($sendHeader) { | ||||
|             $this->debugBar->getHttpDriver()->setHeaders(array( | ||||
|                     'Content-Type' => 'application/json' | ||||
|                 )); | ||||
|         } | ||||
|  | ||||
|         $response = json_encode(call_user_func(array($this, $op), $request)); | ||||
|         if ($echo) { | ||||
|             echo $response; | ||||
|         } | ||||
|         return $response; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Find operation | ||||
|      * @param $request | ||||
|      * @return array | ||||
|      */ | ||||
|     protected function find($request) | ||||
|     { | ||||
|         $max = 20; | ||||
|         if (isset($request['max'])) { | ||||
|             $max = $request['max']; | ||||
|         } | ||||
|  | ||||
|         $offset = 0; | ||||
|         if (isset($request['offset'])) { | ||||
|             $offset = $request['offset']; | ||||
|         } | ||||
|  | ||||
|         $filters = array(); | ||||
|         foreach (array('utime', 'datetime', 'ip', 'uri', 'method') as $key) { | ||||
|             if (isset($request[$key])) { | ||||
|                 $filters[$key] = $request[$key]; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return $this->debugBar->getStorage()->find($filters, $max, $offset); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get operation | ||||
|      * @param $request | ||||
|      * @return array | ||||
|      * @throws DebugBarException | ||||
|      */ | ||||
|     protected function get($request) | ||||
|     { | ||||
|         if (!isset($request['id'])) { | ||||
|             throw new DebugBarException("Missing 'id' parameter in 'get' operation"); | ||||
|         } | ||||
|         return $this->debugBar->getStorage()->get($request['id']); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Clear operation | ||||
|      */ | ||||
|     protected function clear($request) | ||||
|     { | ||||
|         $this->debugBar->getStorage()->clear(); | ||||
|         return array('success' => true); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										70
									
								
								vendor/maximebf/debugbar/src/DebugBar/PhpHttpDriver.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								vendor/maximebf/debugbar/src/DebugBar/PhpHttpDriver.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,70 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar; | ||||
|  | ||||
| /** | ||||
|  * HTTP driver for native php | ||||
|  */ | ||||
| class PhpHttpDriver implements HttpDriverInterface | ||||
| { | ||||
|     /** | ||||
|      * @param array $headers | ||||
|      */ | ||||
|     function setHeaders(array $headers) | ||||
|     { | ||||
|         foreach ($headers as $name => $value) { | ||||
|             header("$name: $value"); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return bool | ||||
|      */ | ||||
|     function isSessionStarted() | ||||
|     { | ||||
|         return isset($_SESSION); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param string $name | ||||
|      * @param string $value | ||||
|      */ | ||||
|     function setSessionValue($name, $value) | ||||
|     { | ||||
|         $_SESSION[$name] = $value; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param string $name | ||||
|      * @return bool | ||||
|      */ | ||||
|     function hasSessionValue($name) | ||||
|     { | ||||
|         return array_key_exists($name, $_SESSION); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param string $name | ||||
|      * @return mixed | ||||
|      */ | ||||
|     function getSessionValue($name) | ||||
|     { | ||||
|         return $_SESSION[$name]; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param string $name | ||||
|      */ | ||||
|     function deleteSessionValue($name) | ||||
|     { | ||||
|         unset($_SESSION[$name]); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										43
									
								
								vendor/maximebf/debugbar/src/DebugBar/RequestIdGenerator.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								vendor/maximebf/debugbar/src/DebugBar/RequestIdGenerator.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,43 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar; | ||||
|  | ||||
| /** | ||||
|  * Basic request ID generator | ||||
|  */ | ||||
| class RequestIdGenerator implements RequestIdGeneratorInterface | ||||
| { | ||||
|     protected $index = 0; | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      */ | ||||
|     public function generate() | ||||
|     { | ||||
|         if (function_exists('random_bytes')) { | ||||
|             // PHP 7 only | ||||
|             return 'X' . bin2hex(random_bytes(16)); | ||||
|         } else if (function_exists('openssl_random_pseudo_bytes')) { | ||||
|             // PHP >= 5.3.0, but OpenSSL may not always be available | ||||
|             return 'X' . bin2hex(openssl_random_pseudo_bytes(16)); | ||||
|         } else { | ||||
|             // Fall back to a rudimentary ID generator: | ||||
|             //  * $_SERVER array will make the ID unique to this request. | ||||
|             //  * spl_object_hash($this) will make the ID unique to this object instance. | ||||
|             //    (note that object hashes can be reused, but the other data here should prevent issues here). | ||||
|             //  * uniqid('', true) will use the current microtime(), plus additional random data. | ||||
|             //  * $this->index guarantees the uniqueness of IDs from the current object. | ||||
|             $this->index++; | ||||
|             $entropy = serialize($_SERVER) . uniqid('', true) . spl_object_hash($this) . $this->index; | ||||
|             return 'X' . md5($entropy); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										25
									
								
								vendor/maximebf/debugbar/src/DebugBar/RequestIdGeneratorInterface.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								vendor/maximebf/debugbar/src/DebugBar/RequestIdGeneratorInterface.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar; | ||||
|  | ||||
| interface RequestIdGeneratorInterface | ||||
| { | ||||
|     /** | ||||
|      * Generates a unique id for the current request.  If called repeatedly, a new unique id must | ||||
|      * always be returned on each call to generate() - even across different object instances. | ||||
|      * | ||||
|      * To avoid any potential confusion in ID --> value maps, the returned value must be | ||||
|      * guaranteed to not be all-numeric. | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     function generate(); | ||||
| } | ||||
							
								
								
									
										314
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/debugbar.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										314
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/debugbar.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,314 @@ | ||||
| /* Hide debugbar when printing a page */ | ||||
| @media print { | ||||
|   div.phpdebugbar { | ||||
|     display: none; | ||||
|   } | ||||
| } | ||||
|  | ||||
| div.phpdebugbar { | ||||
|   position: fixed; | ||||
|   bottom: 0; | ||||
|   left: 0; | ||||
|   width: 100%; | ||||
|   border-top: 0; | ||||
|   font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif; | ||||
|   background: #fff; | ||||
|   z-index: 10000; | ||||
|   font-size: 14px; | ||||
|   color: #000; | ||||
|   text-align: left; | ||||
|   line-height: 1; | ||||
|   letter-spacing: normal; | ||||
|   direction: ltr; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar a, | ||||
| div.phpdebugbar-openhandler { | ||||
|   cursor: pointer; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar-drag-capture { | ||||
|   position: fixed; | ||||
|   top: 0; | ||||
|   bottom: 0; | ||||
|   left: 0; | ||||
|   right: 0; | ||||
|   z-index: 10001; | ||||
|   background: none; | ||||
|   display: none; | ||||
|   cursor: ns-resize; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar-closed { | ||||
|     width: auto; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar * { | ||||
|   margin: 0; | ||||
|   padding: 0; | ||||
|   border: 0; | ||||
|   font-weight: normal; | ||||
|   text-decoration: none; | ||||
|   clear: initial; | ||||
|   width: auto; | ||||
|   -moz-box-sizing: content-box; | ||||
|        box-sizing: content-box; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar ol, div.phpdebugbar ul { | ||||
|   list-style: none; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar table { | ||||
|   border-collapse: collapse; | ||||
|   border-spacing: 0; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar input[type='text'], div.phpdebugbar input[type='password'] { | ||||
|   font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif; | ||||
|   background: #fff; | ||||
|   font-size: 14px; | ||||
|   color: #000; | ||||
|   border: 0; | ||||
|   padding: 0; | ||||
|   margin: 0; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar code, div.phpdebugbar pre, div.phpdebugbar samp { | ||||
|   background: none; | ||||
|   font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; | ||||
|   font-size: 1em; | ||||
|   border: 0; | ||||
|   padding: 0; | ||||
|   margin: 0; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar code, div.phpdebugbar pre { | ||||
|   color: #000; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar pre.sf-dump { | ||||
|   color: #a0a000; | ||||
|   outline: 0; | ||||
| } | ||||
|  | ||||
| a.phpdebugbar-restore-btn { | ||||
|   float: left; | ||||
|   padding: 5px 8px; | ||||
|   font-size: 14px; | ||||
|   color: #555; | ||||
|   text-decoration: none; | ||||
|   border-right: 1px solid #ddd; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar-resize-handle { | ||||
|   display: none; | ||||
|   height: 4px; | ||||
|   margin-top: -4px; | ||||
|   width: 100%; | ||||
|   background: none; | ||||
|   border-bottom: 1px solid #ccc; | ||||
|   cursor: ns-resize; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar-closed, div.phpdebugbar-minimized{ | ||||
|   border-top: 1px solid #ccc; | ||||
| } | ||||
| /* -------------------------------------- */ | ||||
|  | ||||
| div.phpdebugbar-header, a.phpdebugbar-restore-btn { | ||||
|     background: #efefef url(data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2020%2020%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ccircle%20fill%3D%22%23000%22%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%229%22%2F%3E%3Cpath%20d%3D%22M6.039%208.342c.463%200%20.772.084.927.251.154.168.191.455.11.862-.084.424-.247.727-.487.908-.241.182-.608.272-1.1.272h-.743l.456-2.293h.837zm-2.975%204.615h1.22l.29-1.457H5.62c.461%200%20.84-.047%201.139-.142.298-.095.569-.254.812-.477.205-.184.37-.387.497-.608.127-.222.217-.466.27-.734.13-.65.032-1.155-.292-1.518-.324-.362-.84-.543-1.545-.543H4.153l-1.089%205.479zM9.235%206.02h1.21l-.289%201.458h1.079c.679%200%201.147.115%201.405.347.258.231.335.607.232%201.125l-.507%202.55h-1.23l.481-2.424c.055-.276.035-.464-.06-.565-.095-.1-.298-.15-.608-.15H9.98L9.356%2011.5h-1.21l1.089-5.48M15.566%208.342c.464%200%20.773.084.928.251.154.168.19.455.11.862-.084.424-.247.727-.488.908-.24.182-.607.272-1.1.272h-.742l.456-2.293h.836zm-2.974%204.615h1.22l.29-1.457h1.046c.461%200%20.84-.047%201.139-.142.298-.095.569-.254.812-.477.205-.184.37-.387.497-.608.127-.222.217-.466.27-.734.129-.65.032-1.155-.292-1.518-.324-.362-.84-.543-1.545-.543H13.68l-1.089%205.479z%22%20fill%3D%22%23FFF%22%2F%3E%3C%2Fsvg%3E)  no-repeat 5px 4px / 20px 20px; | ||||
| } | ||||
| div.phpdebugbar-header { | ||||
|   padding-left: 29px; | ||||
|   min-height: 26px; | ||||
|   line-height: 16px; | ||||
| } | ||||
| div.phpdebugbar-header:before, div.phpdebugbar-header:after { | ||||
|   display: table; | ||||
|   line-height: 0; | ||||
|   content: ""; | ||||
| } | ||||
| div.phpdebugbar-header:after { | ||||
|   clear: both; | ||||
| } | ||||
| div.phpdebugbar-header-left { | ||||
|   float: left; | ||||
| } | ||||
| div.phpdebugbar-header-right { | ||||
|   float: right; | ||||
| } | ||||
| div.phpdebugbar-header > div > * { | ||||
|   padding: 5px 5px; | ||||
|   font-size: 14px; | ||||
|   color: #555; | ||||
|   text-decoration: none; | ||||
| } | ||||
| div.phpdebugbar-header-left > * { | ||||
|   float: left; | ||||
| } | ||||
| div.phpdebugbar-header-right > * { | ||||
|   float: right; | ||||
| } | ||||
| div.phpdebugbar-header-right > select { | ||||
|   padding: 0; | ||||
| } | ||||
|  | ||||
| /* -------------------------------------- */ | ||||
|  | ||||
| span.phpdebugbar-indicator, | ||||
| a.phpdebugbar-indicator, | ||||
| a.phpdebugbar-close-btn { | ||||
|   border-right: 1px solid #ddd; | ||||
| } | ||||
|  | ||||
| a.phpdebugbar-tab.phpdebugbar-active { | ||||
|   background: #ccc; | ||||
|   color: #444; | ||||
|   background-image: linear-gradient(bottom, rgb(173,173,173) 41%, rgb(209,209,209) 71%); | ||||
|   background-image: -o-linear-gradient(bottom, rgb(173,173,173) 41%, rgb(209,209,209) 71%); | ||||
|   background-image: -moz-linear-gradient(bottom, rgb(173,173,173) 41%, rgb(209,209,209) 71%); | ||||
|   background-image: -webkit-linear-gradient(bottom, rgb(173,173,173) 41%, rgb(209,209,209) 71%); | ||||
|   background-image: -ms-linear-gradient(bottom, rgb(173,173,173) 41%, rgb(209,209,209) 71%); | ||||
|   background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.41, rgb(173,173,173)), color-stop(0.71, rgb(209,209,209))); | ||||
| } | ||||
|   a.phpdebugbar-tab span.phpdebugbar-badge { | ||||
|     display: none; | ||||
|     margin-left: 5px; | ||||
|     font-size: 11px; | ||||
|     line-height: 14px; | ||||
|     padding: 0 6px; | ||||
|     background: #ccc; | ||||
|     border-radius: 4px; | ||||
|     color: #555; | ||||
|     font-weight: normal; | ||||
|     text-shadow: none; | ||||
|     vertical-align: middle; | ||||
|   } | ||||
|   a.phpdebugbar-tab i { | ||||
|     display: none; | ||||
|     vertical-align: middle; | ||||
|   } | ||||
|   a.phpdebugbar-tab span.phpdebugbar-badge.phpdebugbar-visible { | ||||
|     display: inline; | ||||
|   } | ||||
|   a.phpdebugbar-tab span.phpdebugbar-badge.phpdebugbar-important { | ||||
|     background: #ed6868; | ||||
|     color: white; | ||||
|   } | ||||
|  | ||||
| a.phpdebugbar-close-btn, a.phpdebugbar-open-btn, a.phpdebugbar-restore-btn, a.phpdebugbar-minimize-btn , a.phpdebugbar-maximize-btn { | ||||
|   width: 16px; | ||||
|   height: 16px; | ||||
| } | ||||
|  | ||||
| a.phpdebugbar-minimize-btn , a.phpdebugbar-maximize-btn { | ||||
|   padding-right: 0 !important; | ||||
| } | ||||
|  | ||||
| a.phpdebugbar-maximize-btn { display: none} | ||||
|  | ||||
| a.phpdebugbar-minimize-btn { display: block} | ||||
|  | ||||
| div.phpdebugbar-minimized a.phpdebugbar-maximize-btn { display: block} | ||||
|  | ||||
| div.phpdebugbar-minimized a.phpdebugbar-minimize-btn { display: none} | ||||
|  | ||||
| a.phpdebugbar-minimize-btn { | ||||
|   background:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201792%201792%22%20id%3D%22chevron-down%22%3E%3Cpath%20d%3D%22M1683%20808l-742%20741q-19%2019-45%2019t-45-19l-742-741q-19-19-19-45.5t19-45.5l166-165q19-19%2045-19t45%2019l531%20531%20531-531q19-19%2045-19t45%2019l166%20165q19%2019%2019%2045.5t-19%2045.5z%22%2F%3E%3C%2Fsvg%3E) no-repeat 6px 6px / 14px 14px; | ||||
| } | ||||
|  | ||||
| a.phpdebugbar-maximize-btn { | ||||
|   background:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201792%201792%22%20id%3D%22chevron-up%22%3E%3Cpath%20d%3D%22M1683%201331l-166%20165q-19%2019-45%2019t-45-19l-531-531-531%20531q-19%2019-45%2019t-45-19l-166-165q-19-19-19-45.5t19-45.5l742-741q19-19%2045-19t45%2019l742%20741q19%2019%2019%2045.5t-19%2045.5z%22%2F%3E%3C%2Fsvg%3E) no-repeat 6px 6px / 14px 14px; | ||||
| } | ||||
|  | ||||
| a.phpdebugbar-close-btn { | ||||
|   background: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201792%201792%22%20id%3D%22close%22%3E%3Cpath%20d%3D%22M1490%201322q0%2040-28%2068l-136%20136q-28%2028-68%2028t-68-28l-294-294-294%20294q-28%2028-68%2028t-68-28l-136-136q-28-28-28-68t28-68l294-294-294-294q-28-28-28-68t28-68l136-136q28-28%2068-28t68%2028l294%20294%20294-294q28-28%2068-28t68%2028l136%20136q28%2028%2028%2068t-28%2068l-294%20294%20294%20294q28%2028%2028%2068z%22%2F%3E%3C%2Fsvg%3E) no-repeat 9px 6px / 14px 14px; | ||||
| } | ||||
|  | ||||
| a.phpdebugbar-open-btn { | ||||
|   background: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201792%201792%22%20id%3D%22folder-open%22%3E%3Cpath%20d%3D%22M1815%20952q0%2031-31%2066l-336%20396q-43%2051-120.5%2086.5t-143.5%2035.5h-1088q-34%200-60.5-13t-26.5-43q0-31%2031-66l336-396q43-51%20120.5-86.5t143.5-35.5h1088q34%200%2060.5%2013t26.5%2043zm-343-344v160h-832q-94%200-197%2047.5t-164%20119.5l-337%20396-5%206q0-4-.5-12.5t-.5-12.5v-960q0-92%2066-158t158-66h320q92%200%20158%2066t66%20158v32h544q92%200%20158%2066t66%20158z%22%2F%3E%3C%2Fsvg%3E) no-repeat 8px 6px / 14px 14px; | ||||
| } | ||||
|  | ||||
| .phpdebugbar-indicator { | ||||
|   position: relative; | ||||
|   cursor: pointer; | ||||
| } | ||||
|   .phpdebugbar-indicator span.phpdebugbar-text { | ||||
|     margin-left: 5px; | ||||
|   } | ||||
|   .phpdebugbar-indicator span.phpdebugbar-tooltip { | ||||
|     display: none; | ||||
|     position: absolute; | ||||
|     top: -30px; | ||||
|     background: #efefef; | ||||
|     opacity: .7; | ||||
|     border: 1px solid #ccc; | ||||
|     color: #555; | ||||
|     font-size: 11px; | ||||
|     padding: 2px 3px; | ||||
|     z-index: 1000; | ||||
|     text-align: center; | ||||
|     width: 200%; | ||||
|     right: 0; | ||||
|   } | ||||
|   .phpdebugbar-indicator:hover span.phpdebugbar-tooltip:not(.phpdebugbar-disabled) { | ||||
|     display: block; | ||||
|   } | ||||
|  | ||||
| select.phpdebugbar-datasets-switcher { | ||||
|   float: right; | ||||
|   display: none; | ||||
|   margin: 2px 0 0 7px; | ||||
|   max-width: 200px; | ||||
|   max-height: 23px; | ||||
|   padding: 0; | ||||
| } | ||||
|  | ||||
| /* -------------------------------------- */ | ||||
|  | ||||
| div.phpdebugbar-body { | ||||
|   border-top: 1px solid #ccc; | ||||
|   display: none; | ||||
|   position: relative; | ||||
|   height: 300px; | ||||
| } | ||||
|  | ||||
| /* -------------------------------------- */ | ||||
|  | ||||
| div.phpdebugbar-panel { | ||||
|   display: none; | ||||
|   height: 100%; | ||||
|   overflow: auto; | ||||
|   width: 100%; | ||||
| } | ||||
| div.phpdebugbar-panel.phpdebugbar-active { | ||||
|   display: block; | ||||
| } | ||||
|  | ||||
| /* -------------------------------------- */ | ||||
|  | ||||
| div.phpdebugbar-mini-design a.phpdebugbar-tab { | ||||
|   position: relative; | ||||
|   border-right: 1px solid #ddd; | ||||
| } | ||||
|   div.phpdebugbar-mini-design a.phpdebugbar-tab span.phpdebugbar-text { | ||||
|     display: none; | ||||
|   } | ||||
|   div.phpdebugbar-mini-design a.phpdebugbar-tab:hover span.phpdebugbar-text { | ||||
|     display: block; | ||||
|     position: absolute; | ||||
|     top: -30px; | ||||
|     background: #efefef; | ||||
|     opacity: .7; | ||||
|     border: 1px solid #ccc; | ||||
|     color: #555; | ||||
|     font-size: 11px; | ||||
|     padding: 2px 3px; | ||||
|     z-index: 1000; | ||||
|     text-align: center; | ||||
|     right: 0; | ||||
|   } | ||||
|   div.phpdebugbar-mini-design a.phpdebugbar-tab i { | ||||
|     display:inline-block; | ||||
|   } | ||||
							
								
								
									
										1216
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/debugbar.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1216
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/debugbar.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										70
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/openhandler.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/openhandler.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,70 @@ | ||||
| div.phpdebugbar-openhandler-overlay { | ||||
|     position: fixed; | ||||
|     left: 0; | ||||
|     top: 0; | ||||
|     width: 100%; | ||||
|     height: 100%; | ||||
|     background: #000; | ||||
|     opacity: .3; | ||||
|     z-index: 20000; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar-openhandler { | ||||
|     position: fixed; | ||||
|     margin: auto; | ||||
|     top: 0; | ||||
|     bottom: 0; | ||||
|     left: 0; | ||||
|     right: 0; | ||||
|     width: 70%; | ||||
|     height: 70%; | ||||
|     background: #fff; | ||||
|     color: #000; | ||||
|     border: 2px solid #888; | ||||
|     overflow: auto; | ||||
|     z-index: 20001; | ||||
|     font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif; | ||||
|     font-size: 14px; | ||||
|     padding-bottom: 10px; | ||||
| } | ||||
|     div.phpdebugbar-openhandler a { | ||||
|         color: #555; | ||||
|     } | ||||
|     div.phpdebugbar-openhandler .phpdebugbar-openhandler-header { | ||||
|         background: #efefef url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAUCAYAAABvVQZ0AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfdBgcKHQH1H7EUAAADV0lEQVQ4y7WUy28bVRSHvzvjJPbYY48dj80rTe28gCbCivPsAhBthJCoBIEQQGr/BMRjh1gA20plEYSQumFFQbBBEWVV0bLoQ1BC1YfcBDt1UicFZZzYje06M57LokVNaZJ2w7e7597zOzpX53fgfhSgzYzGDmk+7YQe0DMD/UNSD+gZzaedMKOxQ0DbnXf3IP5z1hLtyc8k8q1IuFX/N+i6LopyN7dYtNYR4ti1fO5doLqVmD+oBy90JLs6pJQ8CCEE2dxctnyz/AxQ2SwWjYRbzycTHbscx+Fh8Xg85OazC8VVKw2sqIDS3dlzJBo1X3Bdd8skKSVCiPvirusSChmhoB40rKJ1XFFVT/uGvXFwu+pBQ6erp5OdWq9v1A8KIdo9Ab9/MhJu9TUaDdbWVlEUFYlEureTP/n0IwpLNzh75gwetRlN06jdqoF7+5Mcx8br9fk0nzaJ1+s7nU4NysTupLRtW5ZKJVmpVOWpkz/LjkRCFgoFaduOrFarcnb2quzb0ytnZmZktVaT5fJNWSqV5P59+2RTU9Npxa/5e10p0XU/lmUxOryX7q5OIpEw4xPjxOMxnn/uWdqeaCNmxhgeHSSVSvHi2BidyS6OHv2S9z94D1e6exQzauqObZMeSGOtWNiOQ9iI4iIZGhplfb1CNpulNWyiqAr2xi0A5nN5QiEDze+n0QAkmic7/+diZ6K7bXLyTTxNKr19T/Hq+Css5Be4vpinWCwS8BsEQi3UajVMM45t24zsHaKv72leG59gcuINFKEsC6/X+13cfOT1S1cu8u03x8jl8ti2zfT0NCMjo9RqFS5fyhAMBejp6WZsbD9mLM6pk7+gqio/Hf+Ret1hLpv5Xhgh4+WwEZmey84ykO5HuuqWMwXgOA6ffzHF1NQR5jJ5FPWuxZaWCwcEEHzs0cfPeVtangwGjQdOfbVSpcXrRd0ktFZazVzLzw8rQHlpuXA4FAo/lIU0v3aPkBCCxesLh4Gyeic2c+Ov5d0xM57arsWtcF2XCxdnvpJSfgygbrr7wbJWioYRfqm5uXlH+6iqSr1eJ3P1yjuudD/cbp8BJIUQX/enBoYbjcaWQr//8ds5KeXbQG6n5biZXcABIDaYHkn+ev5sDvgbmAYW+L/5B5NrVZNHcIujAAAAAElFTkSuQmCC)  no-repeat 5px 4px; | ||||
|         padding-left: 29px; | ||||
|         min-height: 26px; | ||||
|         line-height: 25px; | ||||
|         color: #555; | ||||
|         margin-bottom: 10px; | ||||
|     } | ||||
|         div.phpdebugbar-openhandler .phpdebugbar-openhandler-header a { | ||||
|             font-size: 14px; | ||||
|             color: #555; | ||||
|             text-decoration: none; | ||||
|             float: right; | ||||
|             padding: 5px 8px; | ||||
|         } | ||||
|     div.phpdebugbar-openhandler table { | ||||
|         width: 100%; | ||||
|         table-layout: fixed; | ||||
|         font-size: 14px; | ||||
|     } | ||||
|         div.phpdebugbar-openhandler table td { | ||||
|             padding: 6px 3px; | ||||
|             border-bottom: 1px solid #ddd; | ||||
|         } | ||||
|             div.phpdebugbar-openhandler table td a{ | ||||
|                 display: block; | ||||
|                 white-space: nowrap; | ||||
|                 overflow: hidden; | ||||
|                 text-overflow: ellipsis; | ||||
|             } | ||||
|     div.phpdebugbar-openhandler .phpdebugbar-openhandler-actions { | ||||
|         text-align: center; | ||||
|         padding: 7px 0; | ||||
|     } | ||||
|         div.phpdebugbar-openhandler .phpdebugbar-openhandler-actions a { | ||||
|             margin: 0 10px; | ||||
|             color: #555; | ||||
|         } | ||||
							
								
								
									
										202
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/openhandler.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										202
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/openhandler.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,202 @@ | ||||
| if (typeof(PhpDebugBar) == 'undefined') { | ||||
|     // namespace | ||||
|     var PhpDebugBar = {}; | ||||
|     PhpDebugBar.$ = jQuery; | ||||
| } | ||||
|  | ||||
| (function($) { | ||||
|  | ||||
|     var csscls = function(cls) { | ||||
|         return PhpDebugBar.utils.csscls(cls, 'phpdebugbar-openhandler-'); | ||||
|     }; | ||||
|  | ||||
|     PhpDebugBar.OpenHandler = PhpDebugBar.Widget.extend({ | ||||
|  | ||||
|         className: 'phpdebugbar-openhandler', | ||||
|  | ||||
|         defaults: { | ||||
|             items_per_page: 20 | ||||
|         }, | ||||
|  | ||||
|         render: function() { | ||||
|             var self = this; | ||||
|  | ||||
|             this.$el.appendTo('body').hide(); | ||||
|             this.$closebtn = $('<a><i class="phpdebugbar-fa phpdebugbar-fa-times"></i></a>'); | ||||
|             this.$table = $('<tbody />'); | ||||
|             $('<div>PHP DebugBar | Open</div>').addClass(csscls('header')).append(this.$closebtn).appendTo(this.$el); | ||||
|             $('<table><thead><tr><th width="150">Date</th><th width="55">Method</th><th>URL</th><th width="125">IP</th><th width="100">Filter data</th></tr></thead></table>').append(this.$table).appendTo(this.$el); | ||||
|             this.$actions = $('<div />').addClass(csscls('actions')).appendTo(this.$el); | ||||
|  | ||||
|             this.$closebtn.on('click', function() { | ||||
|                 self.hide(); | ||||
|             }); | ||||
|  | ||||
|             this.$loadmorebtn = $('<a>Load more</a>') | ||||
|                 .appendTo(this.$actions) | ||||
|                 .on('click', function() { | ||||
|                     self.find(self.last_find_request, self.last_find_request.offset + self.get('items_per_page'), self.handleFind.bind(self)); | ||||
|                 }); | ||||
|  | ||||
|             this.$showonlycurrentbtn = $('<a>Show only current URL</a>') | ||||
|                 .appendTo(this.$actions) | ||||
|                 .on('click', function() { | ||||
|                     self.$table.empty(); | ||||
|                     self.find({uri: window.location.pathname}, 0, self.handleFind.bind(self)); | ||||
|                 }); | ||||
|  | ||||
|             this.$showallbtn = $('<a>Show all</a>') | ||||
|                 .appendTo(this.$actions) | ||||
|                 .on('click', function() { | ||||
|                     self.refresh(); | ||||
|                 }); | ||||
|  | ||||
|             this.$clearbtn = $('<a>Delete all</a>') | ||||
|                 .appendTo(this.$actions) | ||||
|                 .on('click', function() { | ||||
|                     self.clear(function() { | ||||
|                         self.hide(); | ||||
|                     }); | ||||
|                 }); | ||||
|                  | ||||
|             this.addSearch(); | ||||
|  | ||||
|             this.$overlay = $('<div />').addClass(csscls('overlay')).hide().appendTo('body'); | ||||
|             this.$overlay.on('click', function() { | ||||
|                 self.hide(); | ||||
|             }); | ||||
|         }, | ||||
|  | ||||
|         refresh: function() { | ||||
|             this.$table.empty(); | ||||
|             this.$loadmorebtn.show(); | ||||
|             this.find({}, 0, this.handleFind.bind(this)); | ||||
|         }, | ||||
|          | ||||
|         addSearch: function(){ | ||||
|             var self = this; | ||||
|             var searchBtn = $('<button />') | ||||
|                 .text('Search') | ||||
|                 .attr('type', 'submit') | ||||
|                 .on('click', function(e) { | ||||
|                     self.$table.empty(); | ||||
|                     var search = {}; | ||||
|                     var a = $(this).parent().serializeArray(); | ||||
|                     $.each(a, function() { | ||||
|                         if(this.value){ | ||||
|                             search[this.name] = this.value; | ||||
|                         } | ||||
|                     }); | ||||
|  | ||||
|                     self.find(search, 0, self.handleFind.bind(self)); | ||||
|                     e.preventDefault(); | ||||
|                 }); | ||||
|  | ||||
|             $('<form />') | ||||
|                 .append('<br/><b>Filter results</b><br/>') | ||||
|                 .append('Method: <select name="method"><option></option><option>GET</option><option>POST</option><option>PUT</option><option>DELETE</option></select><br/>') | ||||
|                 .append('Uri: <input type="text" name="uri"><br/>') | ||||
|                 .append('IP: <input type="text" name="ip"><br/>') | ||||
|                 .append(searchBtn) | ||||
|                 .appendTo(this.$actions); | ||||
|         }, | ||||
|  | ||||
|         handleFind: function(data) { | ||||
|             var self = this; | ||||
|             $.each(data, function(i, meta) { | ||||
|                var a = $('<a />') | ||||
|                     .text('Load dataset') | ||||
|                     .on('click', function(e) { | ||||
|                        self.hide(); | ||||
|                        self.load(meta['id'], function(data) { | ||||
|                            self.callback(meta['id'], data); | ||||
|                        }); | ||||
|                        e.preventDefault(); | ||||
|                     }); | ||||
|                      | ||||
|                 var method = $('<a />') | ||||
|                     .text(meta['method']) | ||||
|                     .on('click', function(e) { | ||||
|                         self.$table.empty(); | ||||
|                         self.find({method: meta['method']}, 0, self.handleFind.bind(self)); | ||||
|                         e.preventDefault(); | ||||
|                     }); | ||||
|  | ||||
|                 var uri = $('<a />') | ||||
|                     .text(meta['uri']) | ||||
|                     .on('click', function(e) { | ||||
|                         self.hide(); | ||||
|                         self.load(meta['id'], function(data) { | ||||
|                             self.callback(meta['id'], data); | ||||
|                         }); | ||||
|                         e.preventDefault(); | ||||
|                     }); | ||||
|  | ||||
|                 var ip = $('<a />') | ||||
|                     .text(meta['ip']) | ||||
|                     .on('click', function(e) { | ||||
|                         self.$table.empty(); | ||||
|                         self.find({ip: meta['ip']}, 0, self.handleFind.bind(self)); | ||||
|                         e.preventDefault(); | ||||
|                     }); | ||||
|  | ||||
|                 var search = $('<a />') | ||||
|                     .text('Show URL') | ||||
|                     .on('click', function(e) { | ||||
|                         self.$table.empty(); | ||||
|                         self.find({uri: meta['uri']}, 0, self.handleFind.bind(self)); | ||||
|                         e.preventDefault(); | ||||
|                     }); | ||||
|                      | ||||
|                 $('<tr />') | ||||
|                     .append('<td>' + meta['datetime'] + '</td>') | ||||
|                     .append('<td>' + meta['method'] + '</td>') | ||||
|                     .append($('<td />').append(uri)) | ||||
|                     .append($('<td />').append(ip)) | ||||
|                     .append($('<td />').append(search)) | ||||
|                     .appendTo(self.$table); | ||||
|             }); | ||||
|             if (data.length < this.get('items_per_page')) { | ||||
|                 this.$loadmorebtn.hide(); | ||||
|             } | ||||
|         }, | ||||
|  | ||||
|         show: function(callback) { | ||||
|             this.callback = callback; | ||||
|             this.$el.show(); | ||||
|             this.$overlay.show(); | ||||
|             this.refresh(); | ||||
|         }, | ||||
|  | ||||
|         hide: function() { | ||||
|             this.$el.hide(); | ||||
|             this.$overlay.hide(); | ||||
|         }, | ||||
|  | ||||
|         find: function(filters, offset, callback) { | ||||
|             var data = $.extend({}, filters, {max: this.get('items_per_page'), offset: offset || 0}); | ||||
|             this.last_find_request = data; | ||||
|             this.ajax(data, callback); | ||||
|         }, | ||||
|  | ||||
|         load: function(id, callback) { | ||||
|             this.ajax({op: "get", id: id}, callback); | ||||
|         }, | ||||
|  | ||||
|         clear: function(callback) { | ||||
|             this.ajax({op: "clear"}, callback); | ||||
|         }, | ||||
|  | ||||
|         ajax: function(data, callback) { | ||||
|             $.ajax({ | ||||
|                 dataType: 'json', | ||||
|                 url: this.get('url'), | ||||
|                 data: data, | ||||
|                 success: callback, | ||||
|                 ignoreDebugBarAjaxHandler: true | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|     }); | ||||
|  | ||||
| })(PhpDebugBar.$); | ||||
							
								
								
									
										4
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/css/font-awesome.min.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/css/font-awesome.min.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts/FontAwesome.otf
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts/FontAwesome.otf
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts/fontawesome-webfont.eot
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts/fontawesome-webfont.eot
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										2671
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts/fontawesome-webfont.svg
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2671
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts/fontawesome-webfont.svg
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| After Width: | Height: | Size: 434 KiB | 
							
								
								
									
										
											BIN
										
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts/fontawesome-webfont.ttf
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts/fontawesome-webfont.ttf
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts/fontawesome-webfont.woff
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts/fontawesome-webfont.woff
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts/fontawesome-webfont.woff2
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/fonts/fontawesome-webfont.woff2
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										1
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/highlightjs/highlight.pack.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/highlightjs/highlight.pack.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										125
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/highlightjs/styles/github.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										125
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/highlightjs/styles/github.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,125 @@ | ||||
| /* | ||||
|  | ||||
| github.com style (c) Vasily Polovnyov <vast@whiteants.net> | ||||
|  | ||||
| */ | ||||
|  | ||||
| div.phpdebugbar .hljs { | ||||
|   display: block; padding: 0.5em; | ||||
|   color: #333; | ||||
|   background: #f8f8f8 | ||||
| } | ||||
|  | ||||
| div.phpdebugbar .hljs-comment, | ||||
| div.phpdebugbar .hljs-template_comment, | ||||
| div.phpdebugbar .diff .hljs-header, | ||||
| div.phpdebugbar .hljs-javadoc { | ||||
|   color: #998; | ||||
|   font-style: italic | ||||
| } | ||||
|  | ||||
| div.phpdebugbar .hljs-keyword, | ||||
| div.phpdebugbar .css .rule .hljs-keyword, | ||||
| div.phpdebugbar .hljs-winutils, | ||||
| div.phpdebugbar .javascript .hljs-title, | ||||
| div.phpdebugbar .nginx .hljs-title, | ||||
| div.phpdebugbar .hljs-subst, | ||||
| div.phpdebugbar .hljs-request, | ||||
| div.phpdebugbar .hljs-status { | ||||
|   color: #333; | ||||
|   font-weight: bold | ||||
| } | ||||
|  | ||||
| div.phpdebugbar .hljs-number, | ||||
| div.phpdebugbar .hljs-hexcolor, | ||||
| div.phpdebugbar .ruby .hljs-constant { | ||||
|   color: #099; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar .hljs-string, | ||||
| div.phpdebugbar .hljs-tag .hljs-value, | ||||
| div.phpdebugbar .hljs-phpdoc, | ||||
| div.phpdebugbar .tex .hljs-formula { | ||||
|   color: #d14 | ||||
| } | ||||
|  | ||||
| div.phpdebugbar .hljs-title, | ||||
| div.phpdebugbar .hljs-id, | ||||
| div.phpdebugbar .coffeescript .hljs-params, | ||||
| div.phpdebugbar .scss .hljs-preprocessor { | ||||
|   color: #900; | ||||
|   font-weight: bold | ||||
| } | ||||
|  | ||||
| div.phpdebugbar .javascript .hljs-title, | ||||
| div.phpdebugbar .lisp .hljs-title, | ||||
| div.phpdebugbar .clojure .hljs-title, | ||||
| div.phpdebugbar .hljs-subst { | ||||
|   font-weight: normal | ||||
| } | ||||
|  | ||||
| div.phpdebugbar .hljs-class .hljs-title, | ||||
| div.phpdebugbar .haskell .hljs-type, | ||||
| div.phpdebugbar .vhdl .hljs-literal, | ||||
| div.phpdebugbar .tex .hljs-command { | ||||
|   color: #458; | ||||
|   font-weight: bold | ||||
| } | ||||
|  | ||||
| div.phpdebugbar .hljs-tag, | ||||
| div.phpdebugbar .hljs-tag .hljs-title, | ||||
| div.phpdebugbar .hljs-rules .hljs-property, | ||||
| div.phpdebugbar .django .hljs-tag .hljs-keyword { | ||||
|   color: #000080; | ||||
|   font-weight: normal | ||||
| } | ||||
|  | ||||
| div.phpdebugbar .hljs-attribute, | ||||
| div.phpdebugbar .hljs-variable, | ||||
| div.phpdebugbar .lisp .hljs-body { | ||||
|   color: #008080 | ||||
| } | ||||
|  | ||||
| div.phpdebugbar .hljs-regexp { | ||||
|   color: #009926 | ||||
| } | ||||
|  | ||||
| div.phpdebugbar .hljs-symbol, | ||||
| div.phpdebugbar .ruby .hljs-symbol .hljs-string, | ||||
| div.phpdebugbar .lisp .hljs-keyword, | ||||
| div.phpdebugbar .tex .hljs-special, | ||||
| div.phpdebugbar .hljs-prompt { | ||||
|   color: #990073 | ||||
| } | ||||
|  | ||||
| div.phpdebugbar .hljs-built_in, | ||||
| div.phpdebugbar .lisp .hljs-title, | ||||
| div.phpdebugbar .clojure .hljs-built_in { | ||||
|   color: #0086b3 | ||||
| } | ||||
|  | ||||
| div.phpdebugbar .hljs-preprocessor, | ||||
| div.phpdebugbar .hljs-pragma, | ||||
| div.phpdebugbar .hljs-pi, | ||||
| div.phpdebugbar .hljs-doctype, | ||||
| div.phpdebugbar .hljs-shebang, | ||||
| div.phpdebugbar .hljs-cdata { | ||||
|   color: #999; | ||||
|   font-weight: bold | ||||
| } | ||||
|  | ||||
| div.phpdebugbar .hljs-deletion { | ||||
|   background: #fdd | ||||
| } | ||||
|  | ||||
| div.phpdebugbar .hljs-addition { | ||||
|   background: #dfd | ||||
| } | ||||
|  | ||||
| div.phpdebugbar .diff .hljs-change { | ||||
|   background: #0086b3 | ||||
| } | ||||
|  | ||||
| div.phpdebugbar .hljs-chunk { | ||||
|   color: #aaa | ||||
| } | ||||
							
								
								
									
										2
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/jquery/dist/jquery.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/jquery/dist/jquery.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										261
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/widgets.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										261
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/widgets.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,261 @@ | ||||
| pre.phpdebugbar-widgets-code-block { | ||||
|     white-space: pre; | ||||
|     word-wrap: normal; | ||||
|     overflow: hidden; | ||||
| } | ||||
|   pre.phpdebugbar-widgets-code-block code { | ||||
|     display: block; | ||||
|     overflow-x: auto; | ||||
|     overflow-y: hidden; | ||||
|   } | ||||
|   pre.phpdebugbar-widgets-code-block code.phpdebugbar-widgets-numbered-code { | ||||
|     padding: 5px; | ||||
|   } | ||||
|     pre.phpdebugbar-widgets-code-block code span.phpdebugbar-widgets-highlighted-line { | ||||
|       background: #800000; | ||||
|       color: #fff; | ||||
|       display: inline-block; | ||||
|       min-width: 100%; | ||||
|     } | ||||
|       pre.phpdebugbar-widgets-code-block code span.phpdebugbar-widgets-highlighted-line span { | ||||
|         background: none !important; | ||||
|         color: inherit !important; | ||||
|       } | ||||
|   pre.phpdebugbar-widgets-code-block ul { | ||||
|     float: left; | ||||
|     padding: 5px; | ||||
|     background: #cacaca; | ||||
|     border-right: 1px solid #aaa; | ||||
|     text-align: right; | ||||
|   } | ||||
|  | ||||
| /* -------------------------------------- */ | ||||
|  | ||||
| ul.phpdebugbar-widgets-list { | ||||
|   margin: 0; | ||||
|   padding: 0; | ||||
|   list-style: none; | ||||
|   font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; | ||||
| } | ||||
|   ul.phpdebugbar-widgets-list li.phpdebugbar-widgets-list-item { | ||||
|     padding: 3px 6px; | ||||
|     border-bottom: 1px solid #eee; | ||||
|     position: relative; | ||||
|     overflow: hidden; | ||||
|   } | ||||
|   ul.phpdebugbar-widgets-list li.phpdebugbar-widgets-list-item:hover { | ||||
|     background: #fafafa; | ||||
|   } | ||||
|  | ||||
| /* -------------------------------------- */ | ||||
|  | ||||
| div.phpdebugbar-widgets-messages { | ||||
|   position: relative; | ||||
|   height: 100%; | ||||
| } | ||||
|   div.phpdebugbar-widgets-messages ul.phpdebugbar-widgets-list { | ||||
|     padding-bottom: 20px; | ||||
|   } | ||||
|   div.phpdebugbar-widgets-messages li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-value.phpdebugbar-widgets-warning:before { | ||||
|     font-family: PhpDebugbarFontAwesome; | ||||
|     content: "\f071"; | ||||
|     margin-right: 8px; | ||||
|     font-size: 11px; | ||||
|     color: #ecb03d; | ||||
|   } | ||||
|   div.phpdebugbar-widgets-messages li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-value.phpdebugbar-widgets-error { | ||||
|     color: red; | ||||
|   } | ||||
|   div.phpdebugbar-widgets-messages li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-value.phpdebugbar-widgets-error:before { | ||||
|     font-family: PhpDebugbarFontAwesome; | ||||
|     content: "\f057"; | ||||
|     margin-right: 8px; | ||||
|     font-size: 11px; | ||||
|     color: red; | ||||
|   } | ||||
|   div.phpdebugbar-widgets-messages li.phpdebugbar-widgets-list-item pre.sf-dump { | ||||
|     display: inline; | ||||
|   } | ||||
|   div.phpdebugbar-widgets-messages li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-collector, | ||||
|   div.phpdebugbar-widgets-messages li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-label { | ||||
|     float: right; | ||||
|     font-size: 12px; | ||||
|     padding: 2px 4px; | ||||
|     color: #888; | ||||
|     margin: 0 2px; | ||||
|     text-decoration: none; | ||||
|     text-shadow: none; | ||||
|     background: none; | ||||
|     font-weight: normal; | ||||
|   } | ||||
|   div.phpdebugbar-widgets-messages li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-collector { | ||||
|     color: #555; | ||||
|     font-style: italic; | ||||
|   } | ||||
|   div.phpdebugbar-widgets-messages div.phpdebugbar-widgets-toolbar { | ||||
|     position: fixed; | ||||
|     bottom: 0; | ||||
|     width: 100%; | ||||
|     background: #fff; | ||||
|   } | ||||
|     div.phpdebugbar-widgets-messages div.phpdebugbar-widgets-toolbar input { | ||||
|       border: 0; | ||||
|       margin: 0; | ||||
|       margin-left: 7px; | ||||
|       width: 50%; | ||||
|       box-shadow: none; | ||||
|     } | ||||
|     div.phpdebugbar-widgets-messages div.phpdebugbar-widgets-toolbar input:focus { | ||||
|       outline: none; | ||||
|     } | ||||
|       div.phpdebugbar-widgets-messages div.phpdebugbar-widgets-toolbar a.phpdebugbar-widgets-filter { | ||||
|         float: right; | ||||
|         font-size: 12px; | ||||
|         padding: 2px 4px; | ||||
|         background: #7cacd5; | ||||
|         margin: 0 2px; | ||||
|         border-radius: 4px; | ||||
|         color: #fff; | ||||
|         text-decoration: none; | ||||
|       } | ||||
|       div.phpdebugbar-widgets-messages div.phpdebugbar-widgets-toolbar a.phpdebugbar-widgets-filter.phpdebugbar-widgets-excluded { | ||||
|         background: #eee; | ||||
|         color: #888; | ||||
|       } | ||||
|  | ||||
| /* -------------------------------------- */ | ||||
|  | ||||
| dl.phpdebugbar-widgets-kvlist { | ||||
|   margin: 0; | ||||
| } | ||||
|   dl.phpdebugbar-widgets-kvlist dt { | ||||
|     float: left; | ||||
|     width: 150px; | ||||
|     padding: 5px; | ||||
|     border-top: 1px solid #eee; | ||||
|     font-weight: bold; | ||||
|     clear: both; | ||||
|     overflow: hidden; | ||||
|     text-overflow: ellipsis; | ||||
|     white-space: nowrap; | ||||
|   } | ||||
|   dl.phpdebugbar-widgets-kvlist dd { | ||||
|     margin-left: 160px; | ||||
|     padding: 5px; | ||||
|     border-top: 1px solid #eee; | ||||
|     cursor: pointer; | ||||
|     min-height: 17px; | ||||
|   } | ||||
|  | ||||
| /* -------------------------------------- */ | ||||
|  | ||||
| dl.phpdebugbar-widgets-varlist, | ||||
| dl.phpdebugbar-widgets-htmlvarlist { | ||||
|   font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; | ||||
| } | ||||
|   dl.phpdebugbar-widgets-htmlvarlist dd { | ||||
|     cursor: initial; | ||||
|   } | ||||
|  | ||||
| /* -------------------------------------- */ | ||||
|  | ||||
| ul.phpdebugbar-widgets-timeline { | ||||
|   margin: 0; | ||||
|   padding: 0; | ||||
|   list-style: none; | ||||
| } | ||||
|   ul.phpdebugbar-widgets-timeline .phpdebugbar-widgets-measure { | ||||
|     height: 20px; | ||||
|     position: relative; | ||||
|     border-bottom: 1px solid #eee; | ||||
|     display: block; | ||||
|   } | ||||
|   ul.phpdebugbar-widgets-timeline li:hover { | ||||
|     background: #fafafa; | ||||
|   } | ||||
|     ul.phpdebugbar-widgets-timeline li span.phpdebugbar-widgets-label, | ||||
|     ul.phpdebugbar-widgets-timeline li span.phpdebugbar-widgets-collector { | ||||
|       position: absolute; | ||||
|       font-size: 12px; | ||||
|       font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; | ||||
|       color: #555; | ||||
|       top: 4px; | ||||
|       left: 5px; | ||||
|       background: none; | ||||
|       text-shadow: none; | ||||
|       font-weight: normal; | ||||
|       white-space: pre; | ||||
|     } | ||||
|     ul.phpdebugbar-widgets-timeline li span.phpdebugbar-widgets-collector { | ||||
|       left: initial; | ||||
|       right: 5px; | ||||
|     } | ||||
|     ul.phpdebugbar-widgets-timeline li span.phpdebugbar-widgets-value { | ||||
|       display: block; | ||||
|       position: absolute; | ||||
|       height: 10px; | ||||
|       background: #3db9ec; | ||||
|       top: 5px; | ||||
|       border-radius: 2px; | ||||
|       min-width: 1px; | ||||
|     } | ||||
|     ul.phpdebugbar-widgets-timeline table.phpdebugbar-widgets-params { | ||||
|       display: none; | ||||
|       width: 70%; | ||||
|       margin: 10px; | ||||
|       border: 1px solid #ddd; | ||||
|       font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; | ||||
|       border-collapse: collapse; | ||||
|     } | ||||
|       ul.phpdebugbar-widgets-timeline table.phpdebugbar-widgets-params td { | ||||
|         border: 1px solid #ddd; | ||||
|         padding: 0 5px; | ||||
|       } | ||||
|       ul.phpdebugbar-widgets-timeline table.phpdebugbar-widgets-params .phpdebugbar-widgets-name { | ||||
|         width: 20%; | ||||
|         font-weight: bold; | ||||
|       } | ||||
|  | ||||
| /* -------------------------------------- */ | ||||
|  | ||||
| div.phpdebugbar-widgets-exceptions li.phpdebugbar-widgets-list-item { | ||||
|   cursor: pointer; | ||||
| } | ||||
|   div.phpdebugbar-widgets-exceptions li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-message { | ||||
|     display: block; | ||||
|     color: red; | ||||
|   } | ||||
|  | ||||
|   div.phpdebugbar-widgets-exceptions li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-filename { | ||||
|     display: block; | ||||
|     font-style: italic; | ||||
|     color: #555; | ||||
|   } | ||||
|  | ||||
|   div.phpdebugbar-widgets-exceptions li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-type { | ||||
|     display: block; | ||||
|     position: absolute; | ||||
|     right: 4px; | ||||
|     top: 4px; | ||||
|     font-weight: bold; | ||||
|   } | ||||
|  | ||||
|   div.phpdebugbar-widgets-exceptions li.phpdebugbar-widgets-list-item pre.phpdebugbar-widgets-file { | ||||
|     display: none; | ||||
|     margin: 10px; | ||||
|     padding: 5px; | ||||
|     border: 1px solid #ddd; | ||||
|     font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; | ||||
|   } | ||||
|  | ||||
| div.phpdebugbar-widgets-exceptions a.phpdebugbar-widgets-editor-link:before { | ||||
|   font-family: PhpDebugbarFontAwesome; | ||||
|   margin-right: 4px; | ||||
|   font-size: 12px; | ||||
|   font-style: normal; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar-widgets-exceptions a.phpdebugbar-widgets-editor-link:before { | ||||
|   content: "\f08e"; | ||||
|   margin-left: 4px; | ||||
| } | ||||
							
								
								
									
										589
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/widgets.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										589
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/widgets.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,589 @@ | ||||
| if (typeof(PhpDebugBar) == 'undefined') { | ||||
|     // namespace | ||||
|     var PhpDebugBar = {}; | ||||
|     PhpDebugBar.$ = jQuery; | ||||
| } | ||||
|  | ||||
| (function($) { | ||||
|  | ||||
|     /** | ||||
|      * @namespace | ||||
|      */ | ||||
|     PhpDebugBar.Widgets = {}; | ||||
|  | ||||
|     var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-'); | ||||
|  | ||||
|     /** | ||||
|      * Replaces spaces with   and line breaks with <br> | ||||
|      * | ||||
|      * @param {String} text | ||||
|      * @return {String} | ||||
|      */ | ||||
|     var htmlize = PhpDebugBar.Widgets.htmlize = function(text) { | ||||
|         return text.replace(/\n/g, '<br>').replace(/\s/g, " ") | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|      * Returns a string representation of value, using JSON.stringify | ||||
|      * if it's an object. | ||||
|      * | ||||
|      * @param {Object} value | ||||
|      * @param {Boolean} prettify Uses htmlize() if true | ||||
|      * @return {String} | ||||
|      */ | ||||
|     var renderValue = PhpDebugBar.Widgets.renderValue = function(value, prettify) { | ||||
|         if (typeof(value) !== 'string') { | ||||
|             if (prettify) { | ||||
|                 return htmlize(JSON.stringify(value, undefined, 2)); | ||||
|             } | ||||
|             return JSON.stringify(value); | ||||
|         } | ||||
|         return value; | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|      * Highlights a block of code | ||||
|      * | ||||
|      * @param  {String} code | ||||
|      * @param  {String} lang | ||||
|      * @return {String} | ||||
|      */ | ||||
|     var highlight = PhpDebugBar.Widgets.highlight = function(code, lang) { | ||||
|         if (typeof(code) === 'string') { | ||||
|             if (typeof(hljs) === 'undefined') { | ||||
|                 return htmlize(code); | ||||
|             } | ||||
|             if (lang) { | ||||
|                 return hljs.highlight(lang, code).value; | ||||
|             } | ||||
|             return hljs.highlightAuto(code).value; | ||||
|         } | ||||
|  | ||||
|         if (typeof(hljs) === 'object') { | ||||
|             code.each(function(i, e) { hljs.highlightBlock(e); }); | ||||
|         } | ||||
|         return code; | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|      * Creates a <pre> element with a block of code | ||||
|      * | ||||
|      * @param  {String} code | ||||
|      * @param  {String} lang | ||||
|      * @param  {Number} [firstLineNumber] If provided, shows line numbers beginning with the given value. | ||||
|      * @param  {Number} [highlightedLine] If provided, the given line number will be highlighted. | ||||
|      * @return {String} | ||||
|      */ | ||||
|     var createCodeBlock = PhpDebugBar.Widgets.createCodeBlock = function(code, lang, firstLineNumber, highlightedLine) { | ||||
|         var pre = $('<pre />').addClass(csscls('code-block')); | ||||
|         // Add a newline to prevent <code> element from vertically collapsing too far if the last | ||||
|         // code line was empty: that creates problems with the horizontal scrollbar being | ||||
|         // incorrectly positioned - most noticeable when line numbers are shown. | ||||
|         var codeElement = $('<code />').text(code + '\n').appendTo(pre); | ||||
|  | ||||
|         // Add a span with a special class if we are supposed to highlight a line.  highlight.js will | ||||
|         // still correctly format code even with existing markup in it. | ||||
|         if ($.isNumeric(highlightedLine)) { | ||||
|             if ($.isNumeric(firstLineNumber)) { | ||||
|                 highlightedLine = highlightedLine - firstLineNumber + 1; | ||||
|             } | ||||
|             codeElement.html(function (index, html) { | ||||
|                 var currentLine = 1; | ||||
|                 return html.replace(/^.*$/gm, function(line) { | ||||
|                     if (currentLine++ == highlightedLine) { | ||||
|                         return '<span class="' + csscls('highlighted-line') + '">' + line + '</span>'; | ||||
|                     } else { | ||||
|                         return line; | ||||
|                     } | ||||
|                 }); | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|         // Format the code | ||||
|         if (lang) { | ||||
|             pre.addClass("language-" + lang); | ||||
|         } | ||||
|         highlight(pre); | ||||
|  | ||||
|         // Show line numbers in a list | ||||
|         if ($.isNumeric(firstLineNumber)) { | ||||
|             var lineCount = code.split('\n').length; | ||||
|             var $lineNumbers = $('<ul />').prependTo(pre); | ||||
|             pre.children().addClass(csscls('numbered-code')); | ||||
|             for (var i = firstLineNumber; i < firstLineNumber + lineCount; i++) { | ||||
|                 $('<li />').text(i).appendTo($lineNumbers); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return pre; | ||||
|     }; | ||||
|  | ||||
|     // ------------------------------------------------------------------ | ||||
|     // Generic widgets | ||||
|     // ------------------------------------------------------------------ | ||||
|  | ||||
|     /** | ||||
|      * Displays array element in a <ul> list | ||||
|      * | ||||
|      * Options: | ||||
|      *  - data | ||||
|      *  - itemRenderer: a function used to render list items (optional) | ||||
|      */ | ||||
|     var ListWidget = PhpDebugBar.Widgets.ListWidget = PhpDebugBar.Widget.extend({ | ||||
|  | ||||
|         tagName: 'ul', | ||||
|  | ||||
|         className: csscls('list'), | ||||
|  | ||||
|         initialize: function(options) { | ||||
|             if (!options['itemRenderer']) { | ||||
|                 options['itemRenderer'] = this.itemRenderer; | ||||
|             } | ||||
|             this.set(options); | ||||
|         }, | ||||
|  | ||||
|         render: function() { | ||||
|             this.bindAttr(['itemRenderer', 'data'], function() { | ||||
|                 this.$el.empty(); | ||||
|                 if (!this.has('data')) { | ||||
|                     return; | ||||
|                 } | ||||
|  | ||||
|                 var data = this.get('data'); | ||||
|                 for (var i = 0; i < data.length; i++) { | ||||
|                     var li = $('<li />').addClass(csscls('list-item')).appendTo(this.$el); | ||||
|                     this.get('itemRenderer')(li, data[i]); | ||||
|                 } | ||||
|             }); | ||||
|         }, | ||||
|  | ||||
|         /** | ||||
|          * Renders the content of a <li> element | ||||
|          * | ||||
|          * @param {jQuery} li The <li> element as a jQuery Object | ||||
|          * @param {Object} value An item from the data array | ||||
|          */ | ||||
|         itemRenderer: function(li, value) { | ||||
|             li.html(renderValue(value)); | ||||
|         } | ||||
|  | ||||
|     }); | ||||
|  | ||||
|     // ------------------------------------------------------------------ | ||||
|  | ||||
|     /** | ||||
|      * Displays object property/value paris in a <dl> list | ||||
|      * | ||||
|      * Options: | ||||
|      *  - data | ||||
|      *  - itemRenderer: a function used to render list items (optional) | ||||
|      */ | ||||
|     var KVListWidget = PhpDebugBar.Widgets.KVListWidget = ListWidget.extend({ | ||||
|  | ||||
|         tagName: 'dl', | ||||
|  | ||||
|         className: csscls('kvlist'), | ||||
|  | ||||
|         render: function() { | ||||
|             this.bindAttr(['itemRenderer', 'data'], function() { | ||||
|                 this.$el.empty(); | ||||
|                 if (!this.has('data')) { | ||||
|                     return; | ||||
|                 } | ||||
|  | ||||
|                 var self = this; | ||||
|                 $.each(this.get('data'), function(key, value) { | ||||
|                     var dt = $('<dt />').addClass(csscls('key')).appendTo(self.$el); | ||||
|                     var dd = $('<dd />').addClass(csscls('value')).appendTo(self.$el); | ||||
|                     self.get('itemRenderer')(dt, dd, key, value); | ||||
|                 }); | ||||
|             }); | ||||
|         }, | ||||
|  | ||||
|         /** | ||||
|          * Renders the content of the <dt> and <dd> elements | ||||
|          * | ||||
|          * @param {jQuery} dt The <dt> element as a jQuery Object | ||||
|          * @param {jQuery} dd The <dd> element as a jQuery Object | ||||
|          * @param {String} key Property name | ||||
|          * @param {Object} value Property value | ||||
|          */ | ||||
|         itemRenderer: function(dt, dd, key, value) { | ||||
|             dt.text(key); | ||||
|             dd.html(htmlize(value)); | ||||
|         } | ||||
|  | ||||
|     }); | ||||
|  | ||||
|     // ------------------------------------------------------------------ | ||||
|  | ||||
|     /** | ||||
|      * An extension of KVListWidget where the data represents a list | ||||
|      * of variables | ||||
|      * | ||||
|      * Options: | ||||
|      *  - data | ||||
|      */ | ||||
|     var VariableListWidget = PhpDebugBar.Widgets.VariableListWidget = KVListWidget.extend({ | ||||
|  | ||||
|         className: csscls('kvlist varlist'), | ||||
|  | ||||
|         itemRenderer: function(dt, dd, key, value) { | ||||
|             $('<span />').attr('title', key).text(key).appendTo(dt); | ||||
|  | ||||
|             var v = value; | ||||
|             if (v && v.length > 100) { | ||||
|                 v = v.substr(0, 100) + "..."; | ||||
|             } | ||||
|             var prettyVal = null; | ||||
|             dd.text(v).click(function() { | ||||
|                 if (dd.hasClass(csscls('pretty'))) { | ||||
|                     dd.text(v).removeClass(csscls('pretty')); | ||||
|                 } else { | ||||
|                     prettyVal = prettyVal || createCodeBlock(value); | ||||
|                     dd.addClass(csscls('pretty')).empty().append(prettyVal); | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|     }); | ||||
|  | ||||
|     // ------------------------------------------------------------------ | ||||
|  | ||||
|     /** | ||||
|      * An extension of KVListWidget where the data represents a list | ||||
|      * of variables whose contents are HTML; this is useful for showing | ||||
|      * variable output from VarDumper's HtmlDumper. | ||||
|      * | ||||
|      * Options: | ||||
|      *  - data | ||||
|      */ | ||||
|     var HtmlVariableListWidget = PhpDebugBar.Widgets.HtmlVariableListWidget = KVListWidget.extend({ | ||||
|  | ||||
|         className: csscls('kvlist htmlvarlist'), | ||||
|  | ||||
|         itemRenderer: function(dt, dd, key, value) { | ||||
|             $('<span />').attr('title', key).text(key).appendTo(dt); | ||||
|             dd.html(value); | ||||
|         } | ||||
|  | ||||
|     }); | ||||
|  | ||||
|     // ------------------------------------------------------------------ | ||||
|  | ||||
|     /** | ||||
|      * Iframe widget | ||||
|      * | ||||
|      * Options: | ||||
|      *  - data | ||||
|      */ | ||||
|     var IFrameWidget = PhpDebugBar.Widgets.IFrameWidget = PhpDebugBar.Widget.extend({ | ||||
|  | ||||
|         tagName: 'iframe', | ||||
|  | ||||
|         className: csscls('iframe'), | ||||
|  | ||||
|         render: function() { | ||||
|             this.$el.attr({ | ||||
|                 seamless: "seamless", | ||||
|                 border: "0", | ||||
|                 width: "100%", | ||||
|                 height: "100%" | ||||
|             }); | ||||
|             this.bindAttr('data', function(url) { this.$el.attr('src', url); }); | ||||
|         } | ||||
|  | ||||
|     }); | ||||
|  | ||||
|  | ||||
|     // ------------------------------------------------------------------ | ||||
|     // Collector specific widgets | ||||
|     // ------------------------------------------------------------------ | ||||
|  | ||||
|     /** | ||||
|      * Widget for the MessagesCollector | ||||
|      * | ||||
|      * Uses ListWidget under the hood | ||||
|      * | ||||
|      * Options: | ||||
|      *  - data | ||||
|      */ | ||||
|     var MessagesWidget = PhpDebugBar.Widgets.MessagesWidget = PhpDebugBar.Widget.extend({ | ||||
|  | ||||
|         className: csscls('messages'), | ||||
|  | ||||
|         render: function() { | ||||
|             var self = this; | ||||
|  | ||||
|             this.$list = new ListWidget({ itemRenderer: function(li, value) { | ||||
|                 if (value.message_html) { | ||||
|                     var val = $('<span />').addClass(csscls('value')).html(value.message_html).appendTo(li); | ||||
|                 } else { | ||||
|                     var m = value.message; | ||||
|                     if (m.length > 100) { | ||||
|                         m = m.substr(0, 100) + "..."; | ||||
|                     } | ||||
|  | ||||
|                     var val = $('<span />').addClass(csscls('value')).text(m).appendTo(li); | ||||
|                     if (!value.is_string || value.message.length > 100) { | ||||
|                         var prettyVal = value.message; | ||||
|                         if (!value.is_string) { | ||||
|                             prettyVal = null; | ||||
|                         } | ||||
|                         li.css('cursor', 'pointer').click(function () { | ||||
|                             if (val.hasClass(csscls('pretty'))) { | ||||
|                                 val.text(m).removeClass(csscls('pretty')); | ||||
|                             } else { | ||||
|                                 prettyVal = prettyVal || createCodeBlock(value.message, 'php'); | ||||
|                                 val.addClass(csscls('pretty')).empty().append(prettyVal); | ||||
|                             } | ||||
|                         }); | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                 if (value.collector) { | ||||
|                     $('<span />').addClass(csscls('collector')).text(value.collector).prependTo(li); | ||||
|                 } | ||||
|                 if (value.label) { | ||||
|                     val.addClass(csscls(value.label)); | ||||
|                     $('<span />').addClass(csscls('label')).text(value.label).prependTo(li); | ||||
|                 } | ||||
|             }}); | ||||
|  | ||||
|             this.$list.$el.appendTo(this.$el); | ||||
|             this.$toolbar = $('<div><i class="phpdebugbar-fa phpdebugbar-fa-search"></i></div>').addClass(csscls('toolbar')).appendTo(this.$el); | ||||
|  | ||||
|             $('<input type="text" />') | ||||
|                 .on('change', function() { self.set('search', this.value); }) | ||||
|                 .appendTo(this.$toolbar); | ||||
|  | ||||
|             this.bindAttr('data', function(data) { | ||||
|                 this.set({ exclude: [], search: '' }); | ||||
|                 this.$toolbar.find(csscls('.filter')).remove(); | ||||
|  | ||||
|                 var filters = [], self = this; | ||||
|                 for (var i = 0; i < data.length; i++) { | ||||
|                     if (!data[i].label || $.inArray(data[i].label, filters) > -1) { | ||||
|                         continue; | ||||
|                     } | ||||
|                     filters.push(data[i].label); | ||||
|                     $('<a />') | ||||
|                         .addClass(csscls('filter')) | ||||
|                         .text(data[i].label) | ||||
|                         .attr('rel', data[i].label) | ||||
|                         .on('click', function() { self.onFilterClick(this); }) | ||||
|                         .appendTo(this.$toolbar); | ||||
|                 } | ||||
|             }); | ||||
|  | ||||
|             this.bindAttr(['exclude', 'search'], function() { | ||||
|                 var data = this.get('data'), | ||||
|                     exclude = this.get('exclude'), | ||||
|                     search = this.get('search'), | ||||
|                     caseless = false, | ||||
|                     fdata = []; | ||||
|  | ||||
|                 if (search && search === search.toLowerCase()) { | ||||
|                     caseless = true; | ||||
|                 } | ||||
|  | ||||
|                 for (var i = 0; i < data.length; i++) { | ||||
|                     var message = caseless ? data[i].message.toLowerCase() : data[i].message; | ||||
|  | ||||
|                     if ((!data[i].label || $.inArray(data[i].label, exclude) === -1) && (!search || message.indexOf(search) > -1)) { | ||||
|                         fdata.push(data[i]); | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                 this.$list.set('data', fdata); | ||||
|             }); | ||||
|         }, | ||||
|  | ||||
|         onFilterClick: function(el) { | ||||
|             $(el).toggleClass(csscls('excluded')); | ||||
|  | ||||
|             var excludedLabels = []; | ||||
|             this.$toolbar.find(csscls('.filter') + csscls('.excluded')).each(function() { | ||||
|                 excludedLabels.push(this.rel); | ||||
|             }); | ||||
|  | ||||
|             this.set('exclude', excludedLabels); | ||||
|         } | ||||
|  | ||||
|     }); | ||||
|  | ||||
|     // ------------------------------------------------------------------ | ||||
|  | ||||
|     /** | ||||
|      * Widget for the TimeDataCollector | ||||
|      * | ||||
|      * Options: | ||||
|      *  - data | ||||
|      */ | ||||
|     var TimelineWidget = PhpDebugBar.Widgets.TimelineWidget = PhpDebugBar.Widget.extend({ | ||||
|  | ||||
|         tagName: 'ul', | ||||
|  | ||||
|         className: csscls('timeline'), | ||||
|  | ||||
|         render: function() { | ||||
|             this.bindAttr('data', function(data) { | ||||
|  | ||||
|                 // ported from php DataFormatter | ||||
|                 var formatDuration = function(seconds) { | ||||
|                     if (seconds < 0.001) | ||||
|                         return (seconds * 1000000).toFixed() + 'μs'; | ||||
|                     else if (seconds < 1) | ||||
|                         return (seconds * 1000).toFixed(2) + 'ms'; | ||||
|                     return (seconds).toFixed(2) +  's'; | ||||
|                 }; | ||||
|  | ||||
|                 this.$el.empty(); | ||||
|                 if (data.measures) { | ||||
|                     var aggregate = {}; | ||||
|  | ||||
|                     for (var i = 0; i < data.measures.length; i++) { | ||||
|                         var measure = data.measures[i]; | ||||
|  | ||||
|                         if(!aggregate[measure.label]) | ||||
|                             aggregate[measure.label] = { count: 0, duration: 0 }; | ||||
|  | ||||
|                         aggregate[measure.label]['count'] += 1; | ||||
|                         aggregate[measure.label]['duration'] += measure.duration; | ||||
|  | ||||
|                         var m = $('<div />').addClass(csscls('measure')), | ||||
|                             li = $('<li />'), | ||||
|                             left = (measure.relative_start * 100 / data.duration).toFixed(2), | ||||
|                             width = Math.min((measure.duration * 100 / data.duration).toFixed(2), 100 - left); | ||||
|  | ||||
|                         m.append($('<span />').addClass(csscls('value')).css({ | ||||
|                             left: left + "%", | ||||
|                             width: width + "%" | ||||
|                         })); | ||||
|                         m.append($('<span />').addClass(csscls('label')).text(measure.label + " (" + measure.duration_str + ")")); | ||||
|  | ||||
|                         if (measure.collector) { | ||||
|                             $('<span />').addClass(csscls('collector')).text(measure.collector).appendTo(m); | ||||
|                         } | ||||
|  | ||||
|                         m.appendTo(li); | ||||
|                         this.$el.append(li); | ||||
|  | ||||
|                         if (measure.params && !$.isEmptyObject(measure.params)) { | ||||
|                             var table = $('<table><tr><th colspan="2">Params</th></tr></table>').addClass(csscls('params')).appendTo(li); | ||||
|                             for (var key in measure.params) { | ||||
|                                 if (typeof measure.params[key] !== 'function') { | ||||
|                                     table.append('<tr><td class="' + csscls('name') + '">' + key + '</td><td class="' + csscls('value') + | ||||
|                                     '"><pre><code>' + measure.params[key] + '</code></pre></td></tr>'); | ||||
|                                 } | ||||
|                             } | ||||
|                             li.css('cursor', 'pointer').click(function() { | ||||
|                                 var table = $(this).find('table'); | ||||
|                                 if (table.is(':visible')) { | ||||
|                                     table.hide(); | ||||
|                                 } else { | ||||
|                                     table.show(); | ||||
|                                 } | ||||
|                             }); | ||||
|                         } | ||||
|                     } | ||||
|  | ||||
|                     // convert to array and sort by duration | ||||
|                     aggregate = $.map(aggregate, function(data, label) { | ||||
|                        return { | ||||
|                            label: label, | ||||
|                            data: data | ||||
|                        } | ||||
|                     }).sort(function(a, b) { | ||||
|                         return b.data.duration - a.data.duration | ||||
|                     }); | ||||
|  | ||||
|                     // build table and add | ||||
|                     var aggregateTable = $('<table style="display: table; border: 0; width: 99%"></table>').addClass(csscls('params')); | ||||
|                     $.each(aggregate, function(i, aggregate) { | ||||
|                         width = Math.min((aggregate.data.duration * 100 / data.duration).toFixed(2), 100); | ||||
|  | ||||
|                         aggregateTable.append('<tr><td class="' + csscls('name') + '">' + aggregate.data.count + ' x ' + aggregate.label + ' (' + width + '%)</td><td class="' + csscls('value') + '">' + | ||||
|                             '<div class="' + csscls('measure') +'">' + | ||||
|                                 '<span class="' + csscls('value') + '" style="width:' + width + '%"></span>' + | ||||
|                                 '<span class="' + csscls('label') + '">' + formatDuration(aggregate.data.duration) + '</span>' + | ||||
|                             '</div></td></tr>'); | ||||
|                     }); | ||||
|  | ||||
|                     this.$el.append('<li/>').find('li:last').append(aggregateTable); | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|     }); | ||||
|  | ||||
|     // ------------------------------------------------------------------ | ||||
|  | ||||
|     /** | ||||
|      * Widget for the displaying exceptions | ||||
|      * | ||||
|      * Options: | ||||
|      *  - data | ||||
|      */ | ||||
|     var ExceptionsWidget = PhpDebugBar.Widgets.ExceptionsWidget = PhpDebugBar.Widget.extend({ | ||||
|  | ||||
|         className: csscls('exceptions'), | ||||
|  | ||||
|         render: function() { | ||||
|             this.$list = new ListWidget({ itemRenderer: function(li, e) { | ||||
|                 $('<span />').addClass(csscls('message')).text(e.message).appendTo(li); | ||||
|                 if (e.file) { | ||||
|                     var header = $('<span />').addClass(csscls('filename')).text(e.file + "#" + e.line); | ||||
|                     if (e.xdebug_link) { | ||||
|                         if (e.xdebug_link.ajax) { | ||||
|                             $('<a title="' + e.xdebug_link.url + '"></a>').on('click', function () { | ||||
|                                 $.ajax(e.xdebug_link.url); | ||||
|                             }).addClass(csscls('editor-link')).appendTo(header); | ||||
|                         } else { | ||||
|                             $('<a href="' + e.xdebug_link.url + '"></a>').addClass(csscls('editor-link')).appendTo(header); | ||||
|                         } | ||||
|                     } | ||||
|                     header.appendTo(li); | ||||
|                 } | ||||
|                 if (e.type) { | ||||
|                     $('<span />').addClass(csscls('type')).text(e.type).appendTo(li); | ||||
|                 } | ||||
|                 if (e.surrounding_lines) { | ||||
|                     var pre = createCodeBlock(e.surrounding_lines.join(""), 'php').addClass(csscls('file')).appendTo(li); | ||||
|                     if (!e.stack_trace_html) { | ||||
|                         // This click event makes the var-dumper hard to use. | ||||
|                         li.click(function () { | ||||
|                             if (pre.is(':visible')) { | ||||
|                                 pre.hide(); | ||||
|                             } else { | ||||
|                                 pre.show(); | ||||
|                             } | ||||
|                         }); | ||||
|                     } | ||||
|                 } | ||||
|                 if (e.stack_trace_html) { | ||||
|                     var $trace = $('<span />').addClass(csscls('filename')).html(e.stack_trace_html); | ||||
|                     $trace.appendTo(li); | ||||
|                 } else if (e.stack_trace) { | ||||
|                     e.stack_trace.split("\n").forEach(function (trace) { | ||||
|                         var $traceLine = $('<div />'); | ||||
|                         $('<span />').addClass(csscls('filename')).text(trace).appendTo($traceLine); | ||||
|                         $traceLine.appendTo(li); | ||||
|                     }); | ||||
|                 } | ||||
|             }}); | ||||
|             this.$list.$el.appendTo(this.$el); | ||||
|  | ||||
|             this.bindAttr('data', function(data) { | ||||
|                 this.$list.set('data', data); | ||||
|                 if (data.length == 1) { | ||||
|                     this.$list.$el.children().first().find(csscls('.file')).show(); | ||||
|                 } | ||||
|             }); | ||||
|  | ||||
|         } | ||||
|  | ||||
|     }); | ||||
|  | ||||
|  | ||||
| })(PhpDebugBar.$); | ||||
							
								
								
									
										12
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/widgets/mails/widget.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/widgets/mails/widget.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
|  | ||||
| div.phpdebugbar-widgets-mails span.phpdebugbar-widgets-subject { | ||||
|   display: block; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar-widgets-mails li.phpdebugbar-widgets-list-item pre.phpdebugbar-widgets-headers { | ||||
|   display: none; | ||||
|   margin: 10px; | ||||
|   padding: 5px; | ||||
|   border: 1px solid #ddd; | ||||
|   font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; | ||||
| } | ||||
							
								
								
									
										40
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/widgets/mails/widget.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/widgets/mails/widget.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | ||||
| (function($) { | ||||
|  | ||||
|     var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-'); | ||||
|  | ||||
|     /** | ||||
|      * Widget for the displaying mails data | ||||
|      * | ||||
|      * Options: | ||||
|      *  - data | ||||
|      */ | ||||
|     var MailsWidget = PhpDebugBar.Widgets.MailsWidget = PhpDebugBar.Widget.extend({ | ||||
|  | ||||
|         className: csscls('mails'), | ||||
|  | ||||
|         render: function() { | ||||
|             this.$list = new  PhpDebugBar.Widgets.ListWidget({ itemRenderer: function(li, mail) { | ||||
|                 $('<span />').addClass(csscls('subject')).text(mail.subject).appendTo(li); | ||||
|                 $('<span />').addClass(csscls('to')).text(mail.to).appendTo(li); | ||||
|                 if (mail.headers) { | ||||
|                     var headers = $('<pre />').addClass(csscls('headers')).appendTo(li); | ||||
|                     $('<code />').text(mail.headers).appendTo(headers); | ||||
|                     li.click(function() { | ||||
|                         if (headers.is(':visible')) { | ||||
|                             headers.hide(); | ||||
|                         } else { | ||||
|                             headers.show(); | ||||
|                         } | ||||
|                     }); | ||||
|                 } | ||||
|             }}); | ||||
|             this.$list.$el.appendTo(this.$el); | ||||
|  | ||||
|             this.bindAttr('data', function(data) { | ||||
|                 this.$list.set('data', data); | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|     }); | ||||
|  | ||||
| })(PhpDebugBar.$); | ||||
							
								
								
									
										118
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/widgets/sqlqueries/widget.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										118
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/widgets/sqlqueries/widget.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,118 @@ | ||||
| div.phpdebugbar-widgets-sqlqueries .phpdebugbar-widgets-status { | ||||
|   font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; | ||||
|   padding: 6px 6px; | ||||
|   border-bottom: 1px solid #ddd; | ||||
|   font-weight: bold; | ||||
|   color: #555; | ||||
|   background: #fafafa; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item.phpdebugbar-widgets-error { | ||||
|   color: red; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-database, | ||||
| div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-duration, | ||||
| div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-memory, | ||||
| div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-row-count, | ||||
| div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-copy-clipboard, | ||||
| div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-stmt-id { | ||||
|   float: right; | ||||
|   margin-left: 8px; | ||||
|   color: #888; | ||||
| } | ||||
| div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-database, | ||||
| div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-duration, | ||||
| div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-memory, | ||||
| div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-row-count, | ||||
| div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-copy-clipboard, | ||||
| div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-status span.phpdebugbar-widgets-stmt-id { | ||||
|   color: #555; | ||||
| } | ||||
| div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-database:before, | ||||
| div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-duration:before, | ||||
| div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-memory:before, | ||||
| div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-row-count:before, | ||||
| div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-copy-clipboard:before, | ||||
| div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-stmt-id:before { | ||||
|   font-family: PhpDebugbarFontAwesome; | ||||
|   margin-right: 4px; | ||||
|   font-size: 12px; | ||||
| } | ||||
| div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-database:before { | ||||
|   content: "\f1c0"; | ||||
| } | ||||
| div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-duration:before { | ||||
|   content: "\f017"; | ||||
| } | ||||
| div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-memory:before { | ||||
|   content: "\f085"; | ||||
| } | ||||
| div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-row-count:before { | ||||
|   content: "\f0ce"; | ||||
| } | ||||
| div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-stmt-id:before { | ||||
|   content: "\f08d"; | ||||
| } | ||||
| div.phpdebugbar-widgets-sqlqueries span.phpdebugbar-widgets-copy-clipboard:before { | ||||
|   content: "\f0c5"; | ||||
| } | ||||
| div.phpdebugbar-widgets-sqlqueries table.phpdebugbar-widgets-params { | ||||
|   display: none; | ||||
|   width: 70%; | ||||
|   margin: 10px; | ||||
|   border: 1px solid #ddd; | ||||
|   font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; | ||||
|   border-collapse: collapse; | ||||
| } | ||||
|   div.phpdebugbar-widgets-sqlqueries table.phpdebugbar-widgets-params td { | ||||
|     border: 1px solid #ddd; | ||||
|     text-align: center; | ||||
|   } | ||||
|   div.phpdebugbar-widgets-sqlqueries table.phpdebugbar-widgets-params .phpdebugbar-widgets-name { | ||||
|     width: 20%; | ||||
|     font-weight: bold; | ||||
|   } | ||||
|  | ||||
| div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-error { | ||||
|   display: block; | ||||
|   font-weight: bold; | ||||
| } | ||||
|  | ||||
| code.phpdebugbar-widgets-sql { | ||||
|   white-space: pre-wrap; | ||||
|   overflow-wrap: break-word; | ||||
|   word-wrap: break-word; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item.phpdebugbar-widgets-sql-duplicate { | ||||
|   background-color: #edeff0; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item.phpdebugbar-widgets-sql-duplicate:hover { | ||||
|   background-color: #ffc; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-toolbar { | ||||
|   display:none; | ||||
|   position: fixed; | ||||
|   bottom: 0; | ||||
|   width: 100%; | ||||
|   background: #fff; | ||||
|   z-index: 1; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-toolbar a.phpdebugbar-widgets-filter { | ||||
|   float: right; | ||||
|   font-size: 12px; | ||||
|   padding: 2px 4px; | ||||
|   background: #7cacd5; | ||||
|   margin: 0 2px; | ||||
|   border-radius: 4px; | ||||
|   color: #fff; | ||||
|   text-decoration: none; | ||||
| } | ||||
| div.phpdebugbar-widgets-sqlqueries div.phpdebugbar-widgets-toolbar a.phpdebugbar-widgets-filter.phpdebugbar-widgets-excluded { | ||||
|   background: #eee; | ||||
|   color: #888; | ||||
| } | ||||
							
								
								
									
										171
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/widgets/sqlqueries/widget.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										171
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/widgets/sqlqueries/widget.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,171 @@ | ||||
| (function($) { | ||||
|  | ||||
|     var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-'); | ||||
|  | ||||
|     /** | ||||
|      * Widget for the displaying sql queries | ||||
|      * | ||||
|      * Options: | ||||
|      *  - data | ||||
|      */ | ||||
|     var SQLQueriesWidget = PhpDebugBar.Widgets.SQLQueriesWidget = PhpDebugBar.Widget.extend({ | ||||
|  | ||||
|         className: csscls('sqlqueries'), | ||||
|  | ||||
|         onFilterClick: function(el) { | ||||
|             $(el).toggleClass(csscls('excluded')); | ||||
|  | ||||
|             var excludedLabels = []; | ||||
|             this.$toolbar.find(csscls('.filter') + csscls('.excluded')).each(function() { | ||||
|                 excludedLabels.push(this.rel); | ||||
|             }); | ||||
|  | ||||
|             this.$list.$el.find("li[connection=" + $(el).attr("rel") + "]").toggle(); | ||||
|  | ||||
|             this.set('exclude', excludedLabels); | ||||
|         }, | ||||
|         onCopyToClipboard: function (el) { | ||||
|             var code = $(el).parent('li').find('code').get(0); | ||||
|             var copy = function () { | ||||
|                 try { | ||||
|                     document.execCommand('copy'); | ||||
|                     alert('Query copied to the clipboard'); | ||||
|                 } catch (err) { | ||||
|                     console.log('Oops, unable to copy'); | ||||
|                 } | ||||
|             }; | ||||
|             var select = function (node) { | ||||
|                 if (document.selection) { | ||||
|                     var range = document.body.createTextRange(); | ||||
|                     range.moveToElementText(node); | ||||
|                     range.select(); | ||||
|                 } else if (window.getSelection) { | ||||
|                     var range = document.createRange(); | ||||
|                     range.selectNodeContents(node); | ||||
|                     window.getSelection().removeAllRanges(); | ||||
|                     window.getSelection().addRange(range); | ||||
|                 } | ||||
|                 copy(); | ||||
|                 window.getSelection().removeAllRanges(); | ||||
|             }; | ||||
|             select(code); | ||||
|         }, | ||||
|         render: function() { | ||||
|             this.$status = $('<div />').addClass(csscls('status')).appendTo(this.$el); | ||||
|  | ||||
|             this.$toolbar = $('<div></div>').addClass(csscls('toolbar')).appendTo(this.$el); | ||||
|  | ||||
|             var filters = [], self = this; | ||||
|  | ||||
|             this.$list = new PhpDebugBar.Widgets.ListWidget({ itemRenderer: function(li, stmt) { | ||||
|                 $('<code />').addClass(csscls('sql')).html(PhpDebugBar.Widgets.highlight(stmt.sql, 'sql')).appendTo(li); | ||||
|                 if (stmt.duration_str) { | ||||
|                     $('<span title="Duration" />').addClass(csscls('duration')).text(stmt.duration_str).appendTo(li); | ||||
|                 } | ||||
|                 if (stmt.memory_str) { | ||||
|                     $('<span title="Memory usage" />').addClass(csscls('memory')).text(stmt.memory_str).appendTo(li); | ||||
|                 } | ||||
|                 if (typeof(stmt.row_count) != 'undefined') { | ||||
|                     $('<span title="Row count" />').addClass(csscls('row-count')).text(stmt.row_count).appendTo(li); | ||||
|                 } | ||||
|                 if (typeof(stmt.stmt_id) != 'undefined' && stmt.stmt_id) { | ||||
|                     $('<span title="Prepared statement ID" />').addClass(csscls('stmt-id')).text(stmt.stmt_id).appendTo(li); | ||||
|                 } | ||||
|                 if (stmt.connection) { | ||||
|                     $('<span title="Connection" />').addClass(csscls('database')).text(stmt.connection).appendTo(li); | ||||
|                     li.attr("connection",stmt.connection); | ||||
|                     if ( $.inArray(stmt.connection, filters) == -1 ) { | ||||
|                         filters.push(stmt.connection); | ||||
|                         $('<a />') | ||||
|                             .addClass(csscls('filter')) | ||||
|                             .text(stmt.connection) | ||||
|                             .attr('rel', stmt.connection) | ||||
|                             .on('click', function() { self.onFilterClick(this); }) | ||||
|                             .appendTo(self.$toolbar); | ||||
|                         if (filters.length>1) { | ||||
|                             self.$toolbar.show(); | ||||
|                             self.$list.$el.css("margin-bottom","20px"); | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|                 if (typeof(stmt.is_success) != 'undefined' && !stmt.is_success) { | ||||
|                     li.addClass(csscls('error')); | ||||
|                     li.append($('<span />').addClass(csscls('error')).text("[" + stmt.error_code + "] " + stmt.error_message)); | ||||
|                 } | ||||
|                 $('<span title="Copy to clipboard" />') | ||||
|                     .addClass(csscls('copy-clipboard')) | ||||
|                     .css('cursor', 'pointer') | ||||
|                     .on('click', function (event) { | ||||
|                         self.onCopyToClipboard(this); | ||||
|                         event.stopPropagation(); | ||||
|                     }) | ||||
|                     .appendTo(li); | ||||
|                 if (stmt.params && !$.isEmptyObject(stmt.params)) { | ||||
|                     var table = $('<table><tr><th colspan="2">Params</th></tr></table>').addClass(csscls('params')).appendTo(li); | ||||
|                     for (var key in stmt.params) { | ||||
|                         if (typeof stmt.params[key] !== 'function') { | ||||
|                             table.append('<tr><td class="' + csscls('name') + '">' + key + '</td><td class="' + csscls('value') + | ||||
|                                 '">' + stmt.params[key] + '</td></tr>'); | ||||
|                         } | ||||
|                     } | ||||
|                     li.css('cursor', 'pointer').click(function() { | ||||
|                         if (table.is(':visible')) { | ||||
|                             table.hide(); | ||||
|                         } else { | ||||
|                             table.show(); | ||||
|                         } | ||||
|                     }); | ||||
|                 } | ||||
|             }}); | ||||
|             this.$list.$el.appendTo(this.$el); | ||||
|  | ||||
|             this.bindAttr('data', function(data) { | ||||
|                 // the PDO collector maybe is empty | ||||
|                 if (data.length <= 0) { | ||||
|                     return false; | ||||
|                 } | ||||
|                 this.$list.set('data', data.statements); | ||||
|                 this.$status.empty(); | ||||
|  | ||||
|                 // Search for duplicate statements. | ||||
|                 for (var sql = {}, unique = 0, duplicate = 0, i = 0; i < data.statements.length; i++) { | ||||
|                     var stmt = data.statements[i].sql; | ||||
|                     if (data.statements[i].params && !$.isEmptyObject(data.statements[i].params)) { | ||||
|                         stmt += ' {' + $.param(data.statements[i].params, false) + '}'; | ||||
|                     } | ||||
|                     sql[stmt] = sql[stmt] || { keys: [] }; | ||||
|                     sql[stmt].keys.push(i); | ||||
|                 } | ||||
|                 // Add classes to all duplicate SQL statements. | ||||
|                 for (var stmt in sql) { | ||||
|                     if (sql[stmt].keys.length > 1) { | ||||
|                         duplicate += sql[stmt].keys.length; | ||||
|                         for (var i = 0; i < sql[stmt].keys.length; i++) { | ||||
|                             this.$list.$el.find('.' + csscls('list-item')).eq(sql[stmt].keys[i]) | ||||
|                                 .addClass(csscls('sql-duplicate')); | ||||
|                         } | ||||
|                     } else { | ||||
|                         unique++; | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                 var t = $('<span />').text(data.nb_statements + " statements were executed").appendTo(this.$status); | ||||
|                 if (data.nb_failed_statements) { | ||||
|                     t.append(", " + data.nb_failed_statements + " of which failed"); | ||||
|                 } | ||||
|                 if (duplicate) { | ||||
|                     t.append(", " + duplicate + " of which were duplicates"); | ||||
|                     t.append(", " + unique + " unique"); | ||||
|                 } | ||||
|                 if (data.accumulated_duration_str) { | ||||
|                     this.$status.append($('<span title="Accumulated duration" />').addClass(csscls('duration')).text(data.accumulated_duration_str)); | ||||
|                 } | ||||
|                 if (data.memory_usage_str) { | ||||
|                     this.$status.append($('<span title="Memory usage" />').addClass(csscls('memory')).text(data.memory_usage_str)); | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|     }); | ||||
|  | ||||
| })(PhpDebugBar.$); | ||||
							
								
								
									
										66
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/widgets/templates/widget.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/widgets/templates/widget.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,66 @@ | ||||
|  | ||||
| div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status { | ||||
|   font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; | ||||
|   padding: 6px 6px; | ||||
|   border-bottom: 1px solid #ddd; | ||||
|   font-weight: bold; | ||||
|   color: #555; | ||||
|   background: #fafafa; | ||||
| } | ||||
|  | ||||
| div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-render-time, | ||||
| div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-memory, | ||||
| div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-param-count, | ||||
| div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-type { | ||||
|   float: right; | ||||
|   margin-left: 8px; | ||||
|   color: #888; | ||||
| } | ||||
| div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status span.phpdebugbar-widgets-render-time, | ||||
| div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status span.phpdebugbar-widgets-memory, | ||||
| div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status span.phpdebugbar-widgets-param-count, | ||||
| div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status span.phpdebugbar-widgets-type { | ||||
|   color: #555; | ||||
| } | ||||
| div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-render-time:before, | ||||
| div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-memory:before, | ||||
| div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-param-count:before, | ||||
| div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-type:before, | ||||
| div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before | ||||
| { | ||||
|   font-family: PhpDebugbarFontAwesome; | ||||
|   margin-right: 4px; | ||||
|   font-size: 12px; | ||||
| } | ||||
| div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-render-time:before { | ||||
|   content: "\f017"; | ||||
| } | ||||
| div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-memory:before { | ||||
|   content: "\f085"; | ||||
| } | ||||
| div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-param-count:before { | ||||
|   content: "\f0ce"; | ||||
| } | ||||
| div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-type:before { | ||||
|   content: "\f121"; | ||||
| } | ||||
| div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before { | ||||
|   content: "\f08e"; | ||||
|   margin-left: 4px; | ||||
| } | ||||
| div.phpdebugbar-widgets-templates table.phpdebugbar-widgets-params { | ||||
|   display: none; | ||||
|   width: 70%; | ||||
|   margin: 10px; | ||||
|   border: 1px solid #ddd; | ||||
|   font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; | ||||
|   border-collapse: collapse; | ||||
| } | ||||
| div.phpdebugbar-widgets-templates table.phpdebugbar-widgets-params td { | ||||
|   border: 1px solid #ddd; | ||||
|   padding: 0 5px; | ||||
| } | ||||
| div.phpdebugbar-widgets-templates table.phpdebugbar-widgets-params .phpdebugbar-widgets-name { | ||||
|   width: 20%; | ||||
|   font-weight: bold; | ||||
| } | ||||
							
								
								
									
										90
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/widgets/templates/widget.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								vendor/maximebf/debugbar/src/DebugBar/Resources/widgets/templates/widget.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,90 @@ | ||||
| (function($) { | ||||
|  | ||||
|     var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-'); | ||||
|  | ||||
|     /** | ||||
|      * Widget for the displaying templates data | ||||
|      * | ||||
|      * Options: | ||||
|      *  - data | ||||
|      */ | ||||
|     var TemplatesWidget = PhpDebugBar.Widgets.TemplatesWidget = PhpDebugBar.Widget.extend({ | ||||
|  | ||||
|         className: csscls('templates'), | ||||
|  | ||||
|         render: function() { | ||||
|             this.$status = $('<div />').addClass(csscls('status')).appendTo(this.$el); | ||||
|  | ||||
|             this.$list = new  PhpDebugBar.Widgets.ListWidget({ itemRenderer: function(li, tpl) { | ||||
|                 $('<span />').addClass(csscls('name')).text(tpl.name).appendTo(li); | ||||
|  | ||||
|                 if (typeof tpl.xdebug_link !== 'undefined' && tpl.xdebug_link !== null) { | ||||
|                     if (tpl.xdebug_link.ajax) { | ||||
|                         $('<a title="' + tpl.xdebug_link.url + '"></a>').on('click', function () { | ||||
|                             $.ajax(tpl.xdebug_link.url); | ||||
|                         }).addClass(csscls('editor-link')).appendTo(li); | ||||
|                     } else { | ||||
|                         $('<a href="' + tpl.xdebug_link.url + '"></a>').addClass(csscls('editor-link')).appendTo(li); | ||||
|                     } | ||||
|                 } | ||||
|                 if (tpl.render_time_str) { | ||||
|                     $('<span title="Render time" />').addClass(csscls('render-time')).text(tpl.render_time_str).appendTo(li); | ||||
|                 } | ||||
|                 if (tpl.memory_str) { | ||||
|                     $('<span title="Memory usage" />').addClass(csscls('memory')).text(tpl.memory_str).appendTo(li); | ||||
|                 } | ||||
|                 if (typeof(tpl.param_count) != 'undefined') { | ||||
|                     $('<span title="Parameter count" />').addClass(csscls('param-count')).text(tpl.param_count).appendTo(li); | ||||
|                 } | ||||
|                 if (typeof(tpl.type) != 'undefined' && tpl.type) { | ||||
|                     $('<span title="Type" />').addClass(csscls('type')).text(tpl.type).appendTo(li); | ||||
|                 } | ||||
|                 if (tpl.params && !$.isEmptyObject(tpl.params)) { | ||||
|                     var table = $('<table><tr><th colspan="2">Params</th></tr></table>').addClass(csscls('params')).appendTo(li); | ||||
|                     for (var key in tpl.params) { | ||||
|                         if (typeof tpl.params[key] !== 'function') { | ||||
|                             table.append('<tr><td class="' + csscls('name') + '">' + key + '</td><td class="' + csscls('value') + | ||||
|                             '"><pre><code>' + tpl.params[key] + '</code></pre></td></tr>'); | ||||
|                         } | ||||
|                     } | ||||
|                     li.css('cursor', 'pointer').click(function() { | ||||
|                         if (table.is(':visible')) { | ||||
|                             table.hide(); | ||||
|                         } else { | ||||
|                             table.show(); | ||||
|                         } | ||||
|                     }); | ||||
|                 } | ||||
|             }}); | ||||
|             this.$list.$el.appendTo(this.$el); | ||||
|             this.$callgraph = $('<div />').addClass(csscls('callgraph')).appendTo(this.$el); | ||||
|  | ||||
|             this.bindAttr('data', function(data) { | ||||
|                 this.$list.set('data', data.templates); | ||||
|                 this.$status.empty(); | ||||
|                 this.$callgraph.empty(); | ||||
|  | ||||
|                 var sentence = data.sentence || "templates were rendered"; | ||||
|                 $('<span />').text(data.nb_templates + " " + sentence).appendTo(this.$status); | ||||
|  | ||||
|                 if (data.accumulated_render_time_str) { | ||||
|                     this.$status.append($('<span title="Accumulated render time" />').addClass(csscls('render-time')).text(data.accumulated_render_time_str)); | ||||
|                 } | ||||
|                 if (data.memory_usage_str) { | ||||
|                     this.$status.append($('<span title="Memory usage" />').addClass(csscls('memory')).text(data.memory_usage_str)); | ||||
|                 } | ||||
|                 if (data.nb_blocks > 0) { | ||||
|                     $('<div />').text(data.nb_blocks + " blocks were rendered").appendTo(this.$status); | ||||
|                 } | ||||
|                 if (data.nb_macros > 0) { | ||||
|                     $('<div />').text(data.nb_macros + " macros were rendered").appendTo(this.$status); | ||||
|                 } | ||||
|                 if (typeof data.callgraph !== 'undefined') { | ||||
|                     this.$callgraph.html(data.callgraph); | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|     }); | ||||
|  | ||||
| })(PhpDebugBar.$); | ||||
							
								
								
									
										34
									
								
								vendor/maximebf/debugbar/src/DebugBar/StandardDebugBar.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								vendor/maximebf/debugbar/src/DebugBar/StandardDebugBar.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar; | ||||
|  | ||||
| use DebugBar\DataCollector\ExceptionsCollector; | ||||
| use DebugBar\DataCollector\MemoryCollector; | ||||
| use DebugBar\DataCollector\MessagesCollector; | ||||
| use DebugBar\DataCollector\PhpInfoCollector; | ||||
| use DebugBar\DataCollector\RequestDataCollector; | ||||
| use DebugBar\DataCollector\TimeDataCollector; | ||||
|  | ||||
| /** | ||||
|  * Debug bar subclass which adds all included collectors | ||||
|  */ | ||||
| class StandardDebugBar extends DebugBar | ||||
| { | ||||
|     public function __construct() | ||||
|     { | ||||
|         $this->addCollector(new PhpInfoCollector()); | ||||
|         $this->addCollector(new MessagesCollector()); | ||||
|         $this->addCollector(new RequestDataCollector()); | ||||
|         $this->addCollector(new TimeDataCollector()); | ||||
|         $this->addCollector(new MemoryCollector()); | ||||
|         $this->addCollector(new ExceptionsCollector()); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										128
									
								
								vendor/maximebf/debugbar/src/DebugBar/Storage/FileStorage.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										128
									
								
								vendor/maximebf/debugbar/src/DebugBar/Storage/FileStorage.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,128 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\Storage; | ||||
|  | ||||
| /** | ||||
|  * Stores collected data into files | ||||
|  */ | ||||
| class FileStorage implements StorageInterface | ||||
| { | ||||
|     protected $dirname; | ||||
|  | ||||
|     /** | ||||
|      * @param string $dirname Directories where to store files | ||||
|      */ | ||||
|     public function __construct($dirname) | ||||
|     { | ||||
|         $this->dirname = rtrim($dirname, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|     public function save($id, $data) | ||||
|     { | ||||
|         if (!file_exists($this->dirname)) { | ||||
|             mkdir($this->dirname, 0777, true); | ||||
|         } | ||||
|         file_put_contents($this->makeFilename($id), json_encode($data)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|     public function get($id) | ||||
|     { | ||||
|         return json_decode(file_get_contents($this->makeFilename($id)), true); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|     public function find(array $filters = array(), $max = 20, $offset = 0) | ||||
|     { | ||||
|         //Loop through all .json files and remember the modified time and id. | ||||
|         $files = array(); | ||||
|         foreach (new \DirectoryIterator($this->dirname) as $file) { | ||||
|             if ($file->getExtension() == 'json') { | ||||
|                 $files[] = array( | ||||
|                     'time' => $file->getMTime(), | ||||
|                     'id' => $file->getBasename('.json') | ||||
|                 ); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         //Sort the files, newest first | ||||
|         usort($files, function ($a, $b) { | ||||
|                 return $a['time'] < $b['time']; | ||||
|             }); | ||||
|  | ||||
|         //Load the metadata and filter the results. | ||||
|         $results = array(); | ||||
|         $i = 0; | ||||
|         foreach ($files as $file) { | ||||
|             //When filter is empty, skip loading the offset | ||||
|             if ($i++ < $offset && empty($filters)) { | ||||
|                 $results[] = null; | ||||
|                 continue; | ||||
|             } | ||||
|             $data = $this->get($file['id']); | ||||
|             $meta = $data['__meta']; | ||||
|             unset($data); | ||||
|             if ($this->filter($meta, $filters)) { | ||||
|                 $results[] = $meta; | ||||
|             } | ||||
|             if (count($results) >= ($max + $offset)) { | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return array_slice($results, $offset, $max); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Filter the metadata for matches. | ||||
|      *  | ||||
|      * @param  array $meta | ||||
|      * @param  array $filters | ||||
|      * @return bool | ||||
|      */ | ||||
|     protected function filter($meta, $filters) | ||||
|     { | ||||
|         foreach ($filters as $key => $value) { | ||||
|             if (!isset($meta[$key]) || fnmatch($value, $meta[$key]) === false) { | ||||
|                 return false; | ||||
|             } | ||||
|         } | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|     public function clear() | ||||
|     { | ||||
|         foreach (new \DirectoryIterator($this->dirname) as $file) { | ||||
|             if (substr($file->getFilename(), 0, 1) !== '.') { | ||||
|                 unlink($file->getPathname()); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param  string $id | ||||
|      * @return string  | ||||
|      */ | ||||
|     public function makeFilename($id) | ||||
|     { | ||||
|         return $this->dirname . basename($id). ".json"; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										158
									
								
								vendor/maximebf/debugbar/src/DebugBar/Storage/MemcachedStorage.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										158
									
								
								vendor/maximebf/debugbar/src/DebugBar/Storage/MemcachedStorage.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,158 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\Storage; | ||||
|  | ||||
| use Memcached; | ||||
| use ReflectionMethod; | ||||
|  | ||||
| /** | ||||
|  * Stores collected data into Memcache using the Memcached extension | ||||
|  */ | ||||
| class MemcachedStorage implements StorageInterface | ||||
| { | ||||
|     protected $memcached; | ||||
|  | ||||
|     protected $keyNamespace; | ||||
|  | ||||
|     protected $expiration; | ||||
|  | ||||
|     protected $newGetMultiSignature; | ||||
|  | ||||
|     /** | ||||
|      * @param Memcached $memcached | ||||
|      * @param string $keyNamespace Namespace for Memcached key names (to avoid conflict with other Memcached users). | ||||
|      * @param int $expiration Expiration for Memcached entries (see Expiration Times in Memcached documentation). | ||||
|      */ | ||||
|     public function __construct(Memcached $memcached, $keyNamespace = 'phpdebugbar', $expiration = 0) | ||||
|     { | ||||
|         $this->memcached = $memcached; | ||||
|         $this->keyNamespace = $keyNamespace; | ||||
|         $this->expiration = $expiration; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|     public function save($id, $data) | ||||
|     { | ||||
|         $key = $this->createKey($id); | ||||
|         $this->memcached->set($key, $data, $this->expiration); | ||||
|         if (!$this->memcached->append($this->keyNamespace, "|$key")) { | ||||
|             $this->memcached->set($this->keyNamespace, $key, $this->expiration); | ||||
|         } else if ($this->expiration) { | ||||
|             // append doesn't support updating expiration, so do it here: | ||||
|             $this->memcached->touch($this->keyNamespace, $this->expiration); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|     public function get($id) | ||||
|     { | ||||
|         return $this->memcached->get($this->createKey($id)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|     public function find(array $filters = array(), $max = 20, $offset = 0) | ||||
|     { | ||||
|         if (!($keys = $this->memcached->get($this->keyNamespace))) { | ||||
|             return array(); | ||||
|         } | ||||
|  | ||||
|         $results = array(); | ||||
|         $keys = array_reverse(explode('|', $keys)); // Reverse so newest comes first | ||||
|         $keyPosition = 0; // Index in $keys to try to get next items from | ||||
|         $remainingItems = $max + $offset; // Try to obtain this many remaining items | ||||
|         // Loop until we've found $remainingItems matching items or no more items may exist. | ||||
|         while ($remainingItems > 0 && $keyPosition < count($keys)) { | ||||
|             // Consume some keys from $keys: | ||||
|             $itemsToGet = array_slice($keys, $keyPosition, $remainingItems); | ||||
|             $keyPosition += $remainingItems; | ||||
|             // Try to get them, and filter them: | ||||
|             $newItems = $this->memcachedGetMulti($itemsToGet, Memcached::GET_PRESERVE_ORDER); | ||||
|             if ($newItems) { | ||||
|                 foreach ($newItems as $data) { | ||||
|                     $meta = $data['__meta']; | ||||
|                     if ($this->filter($meta, $filters)) { | ||||
|                         $remainingItems--; | ||||
|                         // Keep the result only if we've discarded $offset items first | ||||
|                         if ($offset <= 0) { | ||||
|                             $results[] = $meta; | ||||
|                         } else { | ||||
|                             $offset--; | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         return $results; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Filter the metadata for matches. | ||||
|      *  | ||||
|      * @param  array $meta | ||||
|      * @param  array $filters | ||||
|      * @return bool | ||||
|      */ | ||||
|     protected function filter($meta, $filters) | ||||
|     { | ||||
|         foreach ($filters as $key => $value) { | ||||
|             if (!isset($meta[$key]) || fnmatch($value, $meta[$key]) === false) { | ||||
|                 return false; | ||||
|             } | ||||
|         } | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|     public function clear() | ||||
|     { | ||||
|         if (!($keys = $this->memcached->get($this->keyNamespace))) { | ||||
|             return; | ||||
|         } | ||||
|         $this->memcached->delete($this->keyNamespace); | ||||
|         $this->memcached->deleteMulti(explode('|', $keys)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param  string $id | ||||
|      * @return string  | ||||
|      */ | ||||
|     protected function createKey($id) | ||||
|     { | ||||
|         return md5("{$this->keyNamespace}.$id"); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * The memcached getMulti function changed in version 3.0.0 to only have two parameters. | ||||
|      * | ||||
|      * @param array $keys | ||||
|      * @param int $flags | ||||
|      */ | ||||
|     protected function memcachedGetMulti($keys, $flags) | ||||
|     { | ||||
|         if ($this->newGetMultiSignature === null) { | ||||
|             $this->newGetMultiSignature = (new ReflectionMethod('Memcached', 'getMulti'))->getNumberOfParameters() === 2; | ||||
|         } | ||||
|         if ($this->newGetMultiSignature) { | ||||
|             return $this->memcached->getMulti($keys, $flags); | ||||
|         } else { | ||||
|             $null = null; | ||||
|             return $this->memcached->getMulti($keys, $null, $flags); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										137
									
								
								vendor/maximebf/debugbar/src/DebugBar/Storage/PdoStorage.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										137
									
								
								vendor/maximebf/debugbar/src/DebugBar/Storage/PdoStorage.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,137 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\Storage; | ||||
|  | ||||
| use PDO; | ||||
|  | ||||
| /** | ||||
|  * Stores collected data into a database using PDO | ||||
|  */ | ||||
| class PdoStorage implements StorageInterface | ||||
| { | ||||
|     protected $pdo; | ||||
|  | ||||
|     protected $tableName; | ||||
|  | ||||
|     protected $sqlQueries = array( | ||||
|         'save' => "INSERT INTO %tablename% (id, data, meta_utime, meta_datetime, meta_uri, meta_ip, meta_method) VALUES (?, ?, ?, ?, ?, ?, ?)", | ||||
|         'get' => "SELECT data FROM %tablename% WHERE id = ?", | ||||
|         'find' => "SELECT data FROM %tablename% %where% ORDER BY meta_datetime DESC LIMIT %limit% OFFSET %offset%", | ||||
|         'clear' => "DELETE FROM %tablename%" | ||||
|     ); | ||||
|  | ||||
|     /** | ||||
|      * @param \PDO $pdo The PDO instance | ||||
|      * @param string $tableName | ||||
|      * @param array $sqlQueries | ||||
|      */ | ||||
|     public function __construct(PDO $pdo, $tableName = 'phpdebugbar', array $sqlQueries = array()) | ||||
|     { | ||||
|         $this->pdo = $pdo; | ||||
|         $this->tableName = $tableName; | ||||
|         $this->setSqlQueries($sqlQueries); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sets the sql queries to be used | ||||
|      * | ||||
|      * @param array $queries | ||||
|      */ | ||||
|     public function setSqlQueries(array $queries) | ||||
|     { | ||||
|         $this->sqlQueries = array_merge($this->sqlQueries, $queries); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|     public function save($id, $data) | ||||
|     { | ||||
|         $sql = $this->getSqlQuery('save'); | ||||
|         $stmt = $this->pdo->prepare($sql); | ||||
|         $meta = $data['__meta']; | ||||
|         $stmt->execute(array($id, serialize($data), $meta['utime'], $meta['datetime'], $meta['uri'], $meta['ip'], $meta['method'])); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|     public function get($id) | ||||
|     { | ||||
|         $sql = $this->getSqlQuery('get'); | ||||
|         $stmt = $this->pdo->prepare($sql); | ||||
|         $stmt->execute(array($id)); | ||||
|         if (($data = $stmt->fetchColumn(0)) !== false) { | ||||
|             return unserialize($data); | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|     public function find(array $filters = array(), $max = 20, $offset = 0) | ||||
|     { | ||||
|         $where = array(); | ||||
|         $params = array(); | ||||
|         foreach ($filters as $key => $value) { | ||||
|             $where[] = "meta_$key = ?"; | ||||
|             $params[] = $value; | ||||
|         } | ||||
|         if (count($where)) { | ||||
|             $where = " WHERE " . implode(' AND ', $where); | ||||
|         } else { | ||||
|             $where = ''; | ||||
|         } | ||||
|  | ||||
|         $sql = $this->getSqlQuery('find', array( | ||||
|             'where' => $where, | ||||
|             'offset' => $offset, | ||||
|             'limit' => $max | ||||
|         )); | ||||
|  | ||||
|         $stmt = $this->pdo->prepare($sql); | ||||
|         $stmt->execute($params); | ||||
|  | ||||
|         $results = array(); | ||||
|         foreach ($stmt->fetchAll() as $row) { | ||||
|             $data = unserialize($row['data']); | ||||
|             $results[] = $data['__meta']; | ||||
|             unset($data); | ||||
|         } | ||||
|         return $results; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|     public function clear() | ||||
|     { | ||||
|         $this->pdo->exec($this->getSqlQuery('clear')); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get a SQL Query for a task, with the variables replaced | ||||
|      * | ||||
|      * @param  string $name | ||||
|      * @param  array  $vars | ||||
|      * @return string | ||||
|      */ | ||||
|     protected function getSqlQuery($name, array $vars = array()) | ||||
|     { | ||||
|         $sql = $this->sqlQueries[$name]; | ||||
|         $vars = array_merge(array('tablename' => $this->tableName), $vars); | ||||
|         foreach ($vars as $k => $v) { | ||||
|             $sql = str_replace("%$k%", $v, $sql); | ||||
|         } | ||||
|         return $sql; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										106
									
								
								vendor/maximebf/debugbar/src/DebugBar/Storage/RedisStorage.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										106
									
								
								vendor/maximebf/debugbar/src/DebugBar/Storage/RedisStorage.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,106 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\Storage; | ||||
|  | ||||
| /** | ||||
|  * Stores collected data into Redis | ||||
|  */ | ||||
| class RedisStorage implements StorageInterface | ||||
| { | ||||
|     /** @var \Predis\Client|\Redis */ | ||||
|     protected $redis; | ||||
|  | ||||
|     /** @var string */ | ||||
|     protected $hash; | ||||
|  | ||||
|     /** | ||||
|      * @param  \Predis\Client|\Redis $redis Redis Client | ||||
|      * @param string $hash | ||||
|      */ | ||||
|     public function __construct($redis, $hash = 'phpdebugbar') | ||||
|     { | ||||
|         $this->redis = $redis; | ||||
|         $this->hash = $hash; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|     public function save($id, $data) | ||||
|     { | ||||
|         $this->redis->hSet("$this->hash:meta", $id, serialize($data['__meta'])); | ||||
|         unset($data['__meta']); | ||||
|         $this->redis->hSet("$this->hash:data", $id, serialize($data)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|     public function get($id) | ||||
|     { | ||||
|         return array_merge(unserialize($this->redis->hGet("$this->hash:data", $id)), | ||||
|             array('__meta' => unserialize($this->redis->hGet("$this->hash:meta", $id)))); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|     public function find(array $filters = [], $max = 20, $offset = 0) | ||||
|     { | ||||
|         $results = []; | ||||
|         $cursor = "0"; | ||||
|         $isPhpRedis = get_class($this->redis) === 'Redis'; | ||||
|  | ||||
|         do { | ||||
|             if ($isPhpRedis) { | ||||
|                 $data = $this->redis->hScan("$this->hash:meta", $cursor); | ||||
|             } else { | ||||
|                 [$cursor, $data] = $this->redis->hScan("$this->hash:meta", $cursor); | ||||
|             } | ||||
|  | ||||
|             foreach ($data as $meta) { | ||||
|                 if ($meta = unserialize($meta)) { | ||||
|                     if ($this->filter($meta, $filters)) { | ||||
|                         $results[] = $meta; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } while($cursor); | ||||
|  | ||||
|         usort($results, static function ($a, $b) { | ||||
|             return $b['utime'] <=> $a['utime']; | ||||
|         }); | ||||
|  | ||||
|         return array_slice($results, $offset, $max); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Filter the metadata for matches. | ||||
|      */ | ||||
|     protected function filter($meta, $filters) | ||||
|     { | ||||
|         foreach ($filters as $key => $value) { | ||||
|             if (!isset($meta[$key]) || fnmatch($value, $meta[$key]) === false) { | ||||
|                 return false; | ||||
|             } | ||||
|         } | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritdoc} | ||||
|      */ | ||||
|     public function clear() | ||||
|     { | ||||
|         $this->redis->del("$this->hash:data"); | ||||
|         $this->redis->del("$this->hash:meta"); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										45
									
								
								vendor/maximebf/debugbar/src/DebugBar/Storage/StorageInterface.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								vendor/maximebf/debugbar/src/DebugBar/Storage/StorageInterface.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the DebugBar package. | ||||
|  * | ||||
|  * (c) 2013 Maxime Bouroumeau-Fuseau | ||||
|  * | ||||
|  * For the full copyright and license information, please view the LICENSE | ||||
|  * file that was distributed with this source code. | ||||
|  */ | ||||
|  | ||||
| namespace DebugBar\Storage; | ||||
|  | ||||
| interface StorageInterface | ||||
| { | ||||
|     /** | ||||
|      * Saves collected data | ||||
|      * | ||||
|      * @param string $id | ||||
|      * @param string $data | ||||
|      */ | ||||
|     function save($id, $data); | ||||
|  | ||||
|     /** | ||||
|      * Returns collected data with the specified id | ||||
|      * | ||||
|      * @param string $id | ||||
|      * @return array | ||||
|      */ | ||||
|     function get($id); | ||||
|  | ||||
|     /** | ||||
|      * Returns a metadata about collected data | ||||
|      * | ||||
|      * @param array $filters | ||||
|      * @param integer $max | ||||
|      * @param integer $offset | ||||
|      * @return array | ||||
|      */ | ||||
|     function find(array $filters = array(), $max = 20, $offset = 0); | ||||
|  | ||||
|     /** | ||||
|      * Clears all the collected data | ||||
|      */ | ||||
|     function clear(); | ||||
| } | ||||
							
								
								
									
										16
									
								
								vendor/maximebf/debugbar/src/DebugBar/Storage/pdo_storage_schema.sql
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								vendor/maximebf/debugbar/src/DebugBar/Storage/pdo_storage_schema.sql
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| CREATE TABLE phpdebugbar ( | ||||
|     id TEXT PRIMARY KEY, | ||||
|     data TEXT, | ||||
|     meta_utime TEXT, | ||||
|     meta_datetime TEXT, | ||||
|     meta_uri TEXT, | ||||
|     meta_ip TEXT, | ||||
|     meta_method TEXT | ||||
| ); | ||||
|  | ||||
| CREATE INDEX idx_debugbar_id ON phpdebugbar (id); | ||||
| CREATE INDEX idx_debugbar_meta_utime ON phpdebugbar (meta_utime); | ||||
| CREATE INDEX idx_debugbar_meta_datetime ON phpdebugbar (meta_datetime); | ||||
| CREATE INDEX idx_debugbar_meta_uri ON phpdebugbar (meta_uri); | ||||
| CREATE INDEX idx_debugbar_meta_ip ON phpdebugbar (meta_ip); | ||||
| CREATE INDEX idx_debugbar_meta_method ON phpdebugbar (meta_method); | ||||
		Reference in New Issue
	
	Block a user
	 RafficMohammed
					RafficMohammed