PhpConfigDataCollector.php in Devel 8.3
File
webprofiler/src/DataCollector/PhpConfigDataCollector.php
View source
<?php
namespace Drupal\webprofiler\DataCollector;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\webprofiler\DrupalDataCollectorInterface;
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class PhpConfigDataCollector extends DataCollector implements DrupalDataCollectorInterface {
use StringTranslationTrait, DrupalDataCollectorTrait;
public function collect(Request $request, Response $response, \Exception $exception = NULL) {
$this->data = [
'token' => $response->headers
->get('X-Debug-Token'),
'php_version' => PHP_VERSION,
'xdebug_enabled' => extension_loaded('xdebug'),
'xhprof_enabled' => extension_loaded('xhprof'),
'eaccel_enabled' => extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'),
'apc_enabled' => extension_loaded('apc') && ini_get('apc.enabled'),
'xcache_enabled' => extension_loaded('xcache') && ini_get('xcache.cacher'),
'wincache_enabled' => extension_loaded('wincache') && ini_get('wincache.ocenabled'),
'zend_opcache_enabled' => extension_loaded('Zend OPcache') && ini_get('opcache.enable'),
'sapi_name' => php_sapi_name(),
];
}
public function getToken() {
return $this->data['token'];
}
public function getPhpVersion() {
return $this->data['php_version'];
}
public function hasXDebug() {
return $this->data['xdebug_enabled'];
}
public function hasXHProf() {
return $this->data['xhprof_enabled'];
}
public function hasEAccelerator() {
return $this->data['eaccel_enabled'];
}
public function hasApc() {
return $this->data['apc_enabled'];
}
public function hasZendOpcache() {
return $this->data['zend_opcache_enabled'];
}
public function hasXCache() {
return $this->data['xcache_enabled'];
}
public function hasWinCache() {
return $this->data['wincache_enabled'];
}
public function hasAccelerator() {
return $this
->hasApc() || $this
->hasZendOpcache() || $this
->hasEAccelerator() || $this
->hasXCache() || $this
->hasWinCache();
}
public function getSapiName() {
return $this->data['sapi_name'];
}
public function getTitle() {
return $this
->t('PHP Config');
}
public function getPanelSummary() {
return $this
->t('PHP: @version', [
'@version' => $this
->getPhpVersion(),
]);
}
public function getName() {
return 'php_config';
}
public function getIcon() {
return 'iVBORw0KGgoAAAANSUhEUgAAABUAAAAcCAMAAAC5xgRsAAAAZlBMVEX///////////////////////////////////////////////////////////////////////////////////////////+ZmZmZmZlISEhJSUmdnZ1HR0fR0dFZWVlpaWlfX18/Pz+puygPAAAAIXRSTlMACwwlJygpLzIzNjs8QEtMUmd6e32AucDBw8fIydTm6u5l8MjvAAAAo0lEQVR42r2P2Q6CMBBFL6XsZRGRfZv//0nbDBNEE19MnJeTc5ILKf58ahiUwzy/AJpIWwREwQnEXRdbGCLjrO+djWRvVMiJcigxB7viGogxDdJpSmHEmCVPS7YczJvgUu+CS30IvtbNYZMvsGVo2mVpG/kbm4auiCpdcC3YPCAhSpAdUzaAn6qPKZtUT6ZSzb4bi2hdo9MQ1nX4ASjfV+/4/Z40pyCHrNTbIgAAAABJRU5ErkJggg==';
}
}