class RunConverter in XHProf 8
Casts run identifier into Run object.
Hierarchy
- class \Drupal\xhprof\Routing\RunConverter implements ParamConverterInterface
Expanded class hierarchy of RunConverter
See also
\Drupal\xhprof\Controller\XHProfController::runAction()
\Drush\Commands\core\XhprofCommands::xhprofPost()
1 string reference to 'RunConverter'
1 service uses RunConverter
File
- src/
Routing/ RunConverter.php, line 15
Namespace
Drupal\xhprof\RoutingView source
class RunConverter implements ParamConverterInterface {
/**
* The profiler.
*
* @var \Drupal\xhprof\ProfilerInterface
*/
private $profiler;
/**
* Constructs the RunConverter object
*
* @param \Drupal\xhprof\ProfilerInterface $profiler
* A profiler.
*/
public function __construct(ProfilerInterface $profiler) {
$this->profiler = $profiler;
}
/**
* {@inheritdoc}
*/
public function convert($value, $definition, $name, array $defaults) {
try {
return $this->profiler
->getRun($value);
} catch (\Exception $e) {
return NULL;
}
}
/**
* {@inheritdoc}
*/
public function applies($definition, $name, Route $route) {
if (!empty($definition['type']) && $definition['type'] === 'xhprof:run_id') {
return TRUE;
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RunConverter:: |
private | property | The profiler. | |
RunConverter:: |
public | function |
Determines if the converter applies to a specific route and variable. Overrides ParamConverterInterface:: |
|
RunConverter:: |
public | function |
Converts path variables to their corresponding objects. Overrides ParamConverterInterface:: |
|
RunConverter:: |
public | function | Constructs the RunConverter object |