[ Index ] |
PHP Cross Reference of phpBB-3.1.12-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * This file is part of the Symfony package. 5 * 6 * (c) Fabien Potencier <fabien@symfony.com> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12 namespace Symfony\Component\HttpKernel\DataCollector; 13 14 use Symfony\Component\HttpKernel\KernelInterface; 15 use Symfony\Component\HttpKernel\Kernel; 16 use Symfony\Component\HttpFoundation\Request; 17 use Symfony\Component\HttpFoundation\Response; 18 19 /** 20 * ConfigDataCollector. 21 * 22 * @author Fabien Potencier <fabien@symfony.com> 23 */ 24 class ConfigDataCollector extends DataCollector 25 { 26 private $kernel; 27 private $name; 28 private $version; 29 30 /** 31 * Constructor. 32 * 33 * @param string $name The name of the application using the web profiler 34 * @param string $version The version of the application using the web profiler 35 */ 36 public function __construct($name = null, $version = null) 37 { 38 $this->name = $name; 39 $this->version = $version; 40 } 41 42 /** 43 * Sets the Kernel associated with this Request. 44 * 45 * @param KernelInterface $kernel A KernelInterface instance 46 */ 47 public function setKernel(KernelInterface $kernel = null) 48 { 49 $this->kernel = $kernel; 50 } 51 52 /** 53 * {@inheritdoc} 54 */ 55 public function collect(Request $request, Response $response, \Exception $exception = null) 56 { 57 $this->data = array( 58 'app_name' => $this->name, 59 'app_version' => $this->version, 60 'token' => $response->headers->get('X-Debug-Token'), 61 'symfony_version' => Kernel::VERSION, 62 'name' => isset($this->kernel) ? $this->kernel->getName() : 'n/a', 63 'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a', 64 'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a', 65 'php_version' => PHP_VERSION, 66 'xdebug_enabled' => extension_loaded('xdebug'), 67 'eaccel_enabled' => extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'), 68 'apc_enabled' => extension_loaded('apc') && ini_get('apc.enabled'), 69 'xcache_enabled' => extension_loaded('xcache') && ini_get('xcache.cacher'), 70 'wincache_enabled' => extension_loaded('wincache') && ini_get('wincache.ocenabled'), 71 'zend_opcache_enabled' => extension_loaded('Zend OPcache') && ini_get('opcache.enable'), 72 'bundles' => array(), 73 'sapi_name' => PHP_SAPI, 74 ); 75 76 if (isset($this->kernel)) { 77 foreach ($this->kernel->getBundles() as $name => $bundle) { 78 $this->data['bundles'][$name] = $bundle->getPath(); 79 } 80 } 81 } 82 83 public function getApplicationName() 84 { 85 return $this->data['app_name']; 86 } 87 88 public function getApplicationVersion() 89 { 90 return $this->data['app_version']; 91 } 92 93 /** 94 * Gets the token. 95 * 96 * @return string The token 97 */ 98 public function getToken() 99 { 100 return $this->data['token']; 101 } 102 103 /** 104 * Gets the Symfony version. 105 * 106 * @return string The Symfony version 107 */ 108 public function getSymfonyVersion() 109 { 110 return $this->data['symfony_version']; 111 } 112 113 /** 114 * Gets the PHP version. 115 * 116 * @return string The PHP version 117 */ 118 public function getPhpVersion() 119 { 120 return $this->data['php_version']; 121 } 122 123 /** 124 * Gets the application name. 125 * 126 * @return string The application name 127 */ 128 public function getAppName() 129 { 130 return $this->data['name']; 131 } 132 133 /** 134 * Gets the environment. 135 * 136 * @return string The environment 137 */ 138 public function getEnv() 139 { 140 return $this->data['env']; 141 } 142 143 /** 144 * Returns true if the debug is enabled. 145 * 146 * @return bool true if debug is enabled, false otherwise 147 */ 148 public function isDebug() 149 { 150 return $this->data['debug']; 151 } 152 153 /** 154 * Returns true if the XDebug is enabled. 155 * 156 * @return bool true if XDebug is enabled, false otherwise 157 */ 158 public function hasXDebug() 159 { 160 return $this->data['xdebug_enabled']; 161 } 162 163 /** 164 * Returns true if EAccelerator is enabled. 165 * 166 * @return bool true if EAccelerator is enabled, false otherwise 167 */ 168 public function hasEAccelerator() 169 { 170 return $this->data['eaccel_enabled']; 171 } 172 173 /** 174 * Returns true if APC is enabled. 175 * 176 * @return bool true if APC is enabled, false otherwise 177 */ 178 public function hasApc() 179 { 180 return $this->data['apc_enabled']; 181 } 182 183 /** 184 * Returns true if Zend OPcache is enabled. 185 * 186 * @return bool true if Zend OPcache is enabled, false otherwise 187 */ 188 public function hasZendOpcache() 189 { 190 return $this->data['zend_opcache_enabled']; 191 } 192 193 /** 194 * Returns true if XCache is enabled. 195 * 196 * @return bool true if XCache is enabled, false otherwise 197 */ 198 public function hasXCache() 199 { 200 return $this->data['xcache_enabled']; 201 } 202 203 /** 204 * Returns true if WinCache is enabled. 205 * 206 * @return bool true if WinCache is enabled, false otherwise 207 */ 208 public function hasWinCache() 209 { 210 return $this->data['wincache_enabled']; 211 } 212 213 /** 214 * Returns true if any accelerator is enabled. 215 * 216 * @return bool true if any accelerator is enabled, false otherwise 217 */ 218 public function hasAccelerator() 219 { 220 return $this->hasApc() || $this->hasZendOpcache() || $this->hasEAccelerator() || $this->hasXCache() || $this->hasWinCache(); 221 } 222 223 public function getBundles() 224 { 225 return $this->data['bundles']; 226 } 227 228 /** 229 * Gets the PHP SAPI name. 230 * 231 * @return string The environment 232 */ 233 public function getSapiName() 234 { 235 return $this->data['sapi_name']; 236 } 237 238 /** 239 * {@inheritdoc} 240 */ 241 public function getName() 242 { 243 return 'config'; 244 } 245 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Jan 11 00:25:41 2018 | Cross-referenced by PHPXref 0.7.1 |