本文整理汇总了PHP中app\App::getMessageQueue方法的典型用法代码示例。如果您正苦于以下问题:PHP App::getMessageQueue方法的具体用法?PHP App::getMessageQueue怎么用?PHP App::getMessageQueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\App
的用法示例。
在下文中一共展示了App::getMessageQueue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Method to instantiate the view.
*
* @param App $app The application object.
* @param ModelInterface $model The model object.
* @param string|array $templatesPaths The templates paths.
*
* @throws \RuntimeException
* @since 1.0
*/
public function __construct(App $app, ModelInterface $model, $templatesPaths = '')
{
parent::__construct($model);
$this->app = $app;
$renderer = $app->getContainer()->get('config')->get('renderer.type');
$className = 'App\\View\\Renderer\\' . ucfirst($renderer);
if (false == class_exists($className)) {
throw new \RuntimeException(sprintf('Invalid renderer: %s', $renderer));
}
$config = array();
$config['templates_base_dir'] = JPATH_TEMPLATES;
// Load the renderer.
$this->renderer = new $className($config);
// Register application's Twig extension.
$this->renderer->addExtension(new TwigExtension($app));
// Register additional paths.
if (!empty($templatesPaths)) {
$this->renderer->setTemplatesPaths($templatesPaths, true);
}
// Register the theme path
$this->renderer->set('themePath', DEFAULT_THEME . '/');
// Retrieve and clear the message queue
$this->renderer->set('flashBag', $app->getMessageQueue());
$app->clearMessageQueue();
}