本文整理汇总了PHP中eZTemplate::warning方法的典型用法代码示例。如果您正苦于以下问题:PHP eZTemplate::warning方法的具体用法?PHP eZTemplate::warning怎么用?PHP eZTemplate::warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZTemplate
的用法示例。
在下文中一共展示了eZTemplate::warning方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseMethod
/** Parse the method string to get the class and method names, and check
* that they can be called.
* @param eZTemplate $tpl The template the parse is being done for.
* @param string $method The class::method string to parse into components.
* @return array|null An associative array with the components of the
* parsed string, or null on error.
*/
private function parseMethod($tpl, $method, $functionPlacement = false)
{
$static = false;
$parts = explode('->', $method);
if (count($parts) < 2) {
$static = true;
$parts = explode('::', $method);
if (count($parts) < 2) {
$tpl->warning($this->ESIncludeName, 'Invalid method, missing class/method separator.', $functionPlacement);
return null;
}
}
if (count($parts) > 2) {
$tpl->warning($this->ESIncludeName, 'Invalid method, extra class/method separators.', $functionPlacement);
return null;
}
$class = $parts[0];
$method = $parts[1];
if (!class_exists($class)) {
$tpl->warning($this->ESIncludeName, 'Invalid method, no such class: ' . $class, $functionPlacement);
return null;
}
if (!method_exists($class, $method)) {
$tpl->warning($this->ESIncludeName, 'Invalid method, no such method in class ' . $class . ': ' . $method, $functionPlacement);
return null;
}
if ($static) {
$callable = is_callable(array($class, $method));
} else {
$callable = is_callable(array(new $class(), $method));
}
if (!$callable) {
$tpl->warning($this->ESIncludeName, 'Invalid method, it is not callable: ' . $class . ($static ? '::' : '->') . $method, $functionPlacement);
return null;
}
return array('class' => $class, 'method' => $method, 'static' => $static);
}