本文整理汇总了PHP中Twig_ExtensionInterface::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Twig_ExtensionInterface::getName方法的具体用法?PHP Twig_ExtensionInterface::getName怎么用?PHP Twig_ExtensionInterface::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twig_ExtensionInterface
的用法示例。
在下文中一共展示了Twig_ExtensionInterface::getName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addExtension
/**
* Registers an extension.
*
* @param Twig_ExtensionInterface $extension A Twig_ExtensionInterface instance
*/
public function addExtension(Twig_ExtensionInterface $extension)
{
$this->extensions[$extension->getName()] = $extension;
$this->parsers = null;
$this->visitors = null;
$this->filters = null;
$this->tests = null;
$this->functions = null;
$this->globals = null;
}
示例2: addExtension
/**
* Registers an extension.
*
* @param Twig_ExtensionInterface $extension A Twig_ExtensionInterface instance
*/
public function addExtension(Twig_ExtensionInterface $extension)
{
if ($this->extensionInitialized) {
throw new LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $extension->getName()));
}
$this->extensions[$extension->getName()] = $extension;
}
示例3: addExtension
public function addExtension(Twig_ExtensionInterface $extension)
{
$this->extensions[$extension->getName()] = $extension;
}
示例4: addExtension
/**
* Registers an extension.
*
* @param Twig_ExtensionInterface $extension A Twig_ExtensionInterface instance
*/
public function addExtension(Twig_ExtensionInterface $extension)
{
$name = $extension->getName();
if ($this->extensionInitialized) {
throw new LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $name));
}
if (isset($this->extensions[$name])) {
@trigger_error(sprintf('The possibility to register the same extension twice ("%s") is deprecated since version 1.23 and will be removed in Twig 2.0. Use proper PHP inheritance instead.', $name), E_USER_DEPRECATED);
}
$this->lastModifiedExtension = 0;
$this->extensions[$name] = $extension;
}
示例5: addExtension
/**
* Registers an extension.
*
* @param Twig_ExtensionInterface $extension A Twig_ExtensionInterface instance
*/
public function addExtension(Twig_ExtensionInterface $extension)
{
$name = $extension->getName();
if ($this->extensionInitialized) {
throw new LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $name));
}
if (isset($this->extensions[$name])) {
throw new LogicException(sprintf('Unable to register extension "%s" as it is already registered.', $name));
}
$this->lastModifiedExtension = 0;
$this->extensions[$name] = $extension;
}
示例6: addExtension
public function addExtension(Twig_ExtensionInterface $extension)
{
if ($this->extensionInitialized) {
throw new LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $extension->getName()));
}
$class = get_class($extension);
if ($class !== $extension->getName()) {
if (isset($this->extensions[$extension->getName()])) {
unset($this->extensions[$extension->getName()], $this->extensionsByClass[$class]);
@trigger_error(sprintf('The possibility to register the same extension twice ("%s") is deprecated since version 1.23 and will be removed in Twig 2.0. Use proper PHP inheritance instead.', $extension->getName()), E_USER_DEPRECATED);
}
}
$this->lastModifiedExtension = 0;
$this->extensionsByClass[$class] = $extension;
$this->extensions[$extension->getName()] = $extension;
$this->updateOptionsHash();
}
示例7: addExtension
/**
* Registers an extension.
*
* @param Twig_ExtensionInterface $extension A Twig_ExtensionInterface instance
*/
public function addExtension(Twig_ExtensionInterface $extension)
{
if ($this->extensionInitialized) {
throw new LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $extension->getName()));
}
$r = new ReflectionObject($extension);
if (($extensionTime = filemtime($r->getFileName())) > $this->lastModifiedExtension) {
$this->lastModifiedExtension = $extensionTime;
}
$this->extensions[$extension->getName()] = $extension;
}