本文整理汇总了PHP中Exception::setView方法的典型用法代码示例。如果您正苦于以下问题:PHP Exception::setView方法的具体用法?PHP Exception::setView怎么用?PHP Exception::setView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exception
的用法示例。
在下文中一共展示了Exception::setView方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findHelper
public function findHelper($proxy, $strict = true)
{
$this->view = new \Life\View\View();
if (isset($this->_helpers[$proxy])) {
return $this->_helpers[$proxy];
}
if (!$this->view->getPluginLoader('helper')->getPaths(self::NS)) {
$this->view->addHelperPath(str_replace('_', '/', self::NS), self::NS);
}
if ($strict) {
$helper = $this->view->getHelper($proxy);
} else {
try {
$helper = $this->view->getHelper($proxy);
} catch (Exception $e) {
return null;
}
}
if (!$helper instanceof Navigation\Helper) {
if ($strict) {
$e = new Exception(sprintf('Proxy helper "%s" is not an instance of Life\\View\\Helper\\Navigation\\Helper', get_class($helper)));
$e->setView($this->view);
throw $e;
}
return null;
}
$this->_inject($helper);
$this->_helpers[$proxy] = $helper;
return $helper;
}
示例2: captureStart
/**
* Start capturing content to push into placeholder
*
* @param int $type How to capture content into placeholder; append, prepend, or set
* @return void
* @throws Zend\View\Helper\Placeholer\Container\Exception if nested captures detected
*/
public function captureStart($type = AbstractContainer::APPEND, $key = null)
{
if ($this->_captureLock) {
$e = new Exception('Cannot nest placeholder captures for the same placeholder');
$e->setView($this->view);
throw $e;
}
$this->_captureLock = true;
$this->_captureType = $type;
if (null !== $key && is_scalar($key)) {
$this->_captureKey = (string) $key;
}
ob_start();
}
示例3: _script
/**
* Finds a view script from the available directories.
*
* @param $name string The base name of the script.
* @return void
*/
protected function _script($name)
{
if ($this->isLfiProtectionOn() && preg_match('#\\.\\.[\\\\/]#', $name)) {
$e = new Exception('Requested scripts may not include parent directory traversal ("../", "..\\" notation)');
$e->setView($this);
throw $e;
}
if (0 == count($this->_path['script'])) {
$e = new Exception('no view script directory set; unable to determine location for view script');
$e->setView($this);
throw $e;
}
foreach ($this->_path['script'] as $dir) {
if (is_readable($dir . $name)) {
return $dir . $name;
}
}
$message = "script '{$name}' not found in path (" . implode(PATH_SEPARATOR, $this->_path['script']) . ")";
$e = new Exception($message);
$e->setView($this);
throw $e;
}
示例4: setRole
public function setRole($role = null)
{
if (null === $role || is_string($role) || $role instanceof Zend_Acl_Role_Interface) {
$this->_role = $role;
} else {
$e = new Exception(sprintf('$role must be a string, null, or an instance of Life\\Acl\\Role\\Interface; %s given', gettype($role)));
$e->setView($this->view);
throw $e;
}
return $this;
}
示例5: renderPartial
public function renderPartial(Container $container = null, $partial = null)
{
if (null === $container) {
$container = $this->getContainer();
}
if (null === $partial) {
$partial = $this->getPartial();
}
if (empty($partial)) {
$e = new Exception('Unable to render menu: No partial view script provided');
$e->setView($this->view);
throw $e;
}
// put breadcrumb pages in model
$model = array('pages' => array());
if ($active = $this->findActive($container)) {
$active = $active['page'];
$model['pages'][] = $active;
while ($parent = $active->getParent()) {
if ($parent instanceof NavigationPage) {
$model['pages'][] = $parent;
} else {
break;
}
if ($parent === $container) {
// break if at the root of the given container
break;
}
$active = $parent;
}
$model['pages'] = array_reverse($model['pages']);
}
if (is_array($partial)) {
if (count($partial) != 2) {
$e = new Exception('Unable to render menu: A view partial supplied as an array must contain two values: partial view script and module where script can be found');
$e->setView($this->view);
throw $e;
}
return $this->view->partial($partial[0], $partial[1], $model);
}
return $this->view->partial($partial, null, $model);
}