[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * This file is part of the DebugBar package. 4 * 5 * (c) 2013 Maxime Bouroumeau-Fuseau 6 * 7 * For the full copyright and license information, please view the LICENSE 8 * file that was distributed with this source code. 9 */ 10 11 namespace DebugBar\DataCollector; 12 13 /** 14 * Collects info about the current request 15 */ 16 class RequestDataCollector extends DataCollector implements Renderable, AssetProvider 17 { 18 // The HTML var dumper requires debug bar users to support the new inline assets, which not all 19 // may support yet - so return false by default for now. 20 protected $useHtmlVarDumper = false; 21 22 /** 23 * Sets a flag indicating whether the Symfony HtmlDumper will be used to dump variables for 24 * rich variable rendering. 25 * 26 * @param bool $value 27 * @return $this 28 */ 29 public function useHtmlVarDumper($value = true) 30 { 31 $this->useHtmlVarDumper = $value; 32 return $this; 33 } 34 35 /** 36 * Indicates whether the Symfony HtmlDumper will be used to dump variables for rich variable 37 * rendering. 38 * 39 * @return mixed 40 */ 41 public function isHtmlVarDumperUsed() 42 { 43 return $this->useHtmlVarDumper; 44 } 45 46 /** 47 * @return array 48 */ 49 public function collect() 50 { 51 $vars = array('_GET', '_POST', '_SESSION', '_COOKIE', '_SERVER'); 52 $data = array(); 53 54 foreach ($vars as $var) { 55 if (isset($GLOBALS[$var])) { 56 $key = "$" . $var; 57 if ($this->isHtmlVarDumperUsed()) { 58 $data[$key] = $this->getVarDumper()->renderVar($GLOBALS[$var]); 59 } else { 60 $data[$key] = $this->getDataFormatter()->formatVar($GLOBALS[$var]); 61 } 62 } 63 } 64 65 return $data; 66 } 67 68 /** 69 * @return string 70 */ 71 public function getName() 72 { 73 return 'request'; 74 } 75 76 /** 77 * @return array 78 */ 79 public function getAssets() { 80 return $this->isHtmlVarDumperUsed() ? $this->getVarDumper()->getAssets() : array(); 81 } 82 83 /** 84 * @return array 85 */ 86 public function getWidgets() 87 { 88 $widget = $this->isHtmlVarDumperUsed() 89 ? "PhpDebugBar.Widgets.HtmlVariableListWidget" 90 : "PhpDebugBar.Widgets.VariableListWidget"; 91 return array( 92 "request" => array( 93 "icon" => "tags", 94 "widget" => $widget, 95 "map" => "request", 96 "default" => "{}" 97 ) 98 ); 99 } 100 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |