本文整理汇总了PHP中Debugbar::getCollector方法的典型用法代码示例。如果您正苦于以下问题:PHP Debugbar::getCollector方法的具体用法?PHP Debugbar::getCollector怎么用?PHP Debugbar::getCollector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debugbar
的用法示例。
在下文中一共展示了Debugbar::getCollector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: evaluatePath
/**
* @param $path
* @param array $data
* @return string
*/
protected function evaluatePath($path, array $data = [])
{
$preferences = $this->XSLTSimple->addChild('Preferences');
$url = $preferences->addChild('url');
$url->addAttribute('isHttps', Request::secure());
$url->addAttribute('currentUrl', Request::url());
$url->addAttribute('baseUrl', URL::to(''));
$url->addAttribute('previousUrl', URL::previous());
$server = $preferences->addChild('server');
$server->addAttribute('curretnYear', date('Y'));
$server->addAttribute('curretnMonth', date('m'));
$server->addAttribute('curretnDay', date('d'));
$server->addAttribute('currentDateTime', date('Y-m-d H:i:s'));
$language = $preferences->addChild('language');
$language->addAttribute('current', App::getLocale());
$default_language = \Config::get('app.default_language');
if (isset($default_language)) {
$language->addAttribute('default', $default_language);
}
$languages = \Config::get('app.available_languages');
if (is_array($languages)) {
foreach ($languages as $lang) {
$language->addChild('item', $lang);
}
}
// from form generator
if (isset($data['form'])) {
$this->XSLTSimple->addChild('Form', form($data['form']));
}
// adding form errors to xml
if (isset($data['errors'])) {
$this->XSLTSimple->addData($data['errors']->all(), 'FormErrors', false);
}
// "barryvdh/laravel-debugbar":
// adding XML tab
if (true === class_exists('Debugbar')) {
$dom = dom_import_simplexml($this->XSLTSimple)->ownerDocument;
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$prettyXml = $dom->saveXML();
// add new tab and append xml to it
if (false === \Debugbar::hasCollector('XML')) {
\Debugbar::addCollector(new \DebugBar\DataCollector\MessagesCollector('XML'));
}
\Debugbar::getCollector('XML')->addMessage($prettyXml, 'info', false);
}
$xsl_processor = new \XsltProcessor();
$xsl_processor->registerPHPFunctions();
$xsl_processor->importStylesheet(simplexml_load_file($path));
return $xsl_processor->transformToXML($this->XSLTSimple);
}