class Profiler in Devel 4.x
Same name and namespace in other branches
- 8.3 webprofiler/src/Profiler/Profiler.php \Drupal\webprofiler\Profiler\Profiler
- 8 webprofiler/src/Profiler/Profiler.php \Drupal\webprofiler\Profiler\Profiler
- 8.2 webprofiler/src/Profiler/Profiler.php \Drupal\webprofiler\Profiler\Profiler
Class Profiler.
Hierarchy
- class \Drupal\webprofiler\Profiler\Profiler extends \Symfony\Component\HttpKernel\Profiler\Profiler
Expanded class hierarchy of Profiler
3 files declare their use of Profiler
- DashboardController.php in webprofiler/
src/ Controller/ DashboardController.php - ExportCommand.php in webprofiler/
src/ Command/ ExportCommand.php - ToolbarController.php in webprofiler/
src/ Controller/ ToolbarController.php
1 string reference to 'Profiler'
- webprofiler.services.yml in webprofiler/
webprofiler.services.yml - webprofiler/webprofiler.services.yml
1 service uses Profiler
- profiler in webprofiler/
webprofiler.services.yml - Drupal\webprofiler\Profiler\Profiler
File
- webprofiler/
src/ Profiler/ Profiler.php, line 15
Namespace
Drupal\webprofiler\ProfilerView source
class Profiler extends SymfonyProfiler {
/**
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
private $config;
/**
* @var array
*/
private $activeToolbarItems;
private $localStorage;
private $localLogger;
/**
* Constructor.
*
* @param \Symfony\Component\HttpKernel\Profiler\ProfilerStorageInterface $storage
* A ProfilerStorageInterface instance.
* @param \Psr\Log\LoggerInterface $logger
* A LoggerInterface instance.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config
*/
public function __construct(ProfilerStorageInterface $storage, LoggerInterface $logger = NULL, ConfigFactoryInterface $config) {
parent::__construct($storage, $logger);
$this->localStorage = $storage;
$this->localLogger = $logger;
$this->config = $config;
$this->activeToolbarItems = $this->config
->get('webprofiler.config')
->get('active_toolbar_items');
}
/**
* {@inheritdoc}
*/
public function add(DataCollectorInterface $collector) {
// Drupal collector should not be disabled.
if ($collector
->getName() == 'drupal') {
parent::add($collector);
}
else {
if ($this->activeToolbarItems && array_key_exists($collector
->getName(), $this->activeToolbarItems) && $this->activeToolbarItems[$collector
->getName()] !== '0') {
parent::add($collector);
}
}
}
/**
* @param \Symfony\Component\HttpKernel\Profiler\Profile $profile
*
* @return bool
*/
public function updateProfile(Profile $profile) {
if (!($ret = $this->localStorage
->write($profile)) && NULL !== $this->localLogger) {
$this->localLogger
->warning('Unable to store the profiler information.');
}
return $ret;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Profiler:: |
private | property | ||
Profiler:: |
private | property | ||
Profiler:: |
private | property | ||
Profiler:: |
private | property | ||
Profiler:: |
public | function | ||
Profiler:: |
public | function | ||
Profiler:: |
public | function | Constructor. |