當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Twig_Environment::removeExtension方法代碼示例

本文整理匯總了PHP中Twig_Environment::removeExtension方法的典型用法代碼示例。如果您正苦於以下問題:PHP Twig_Environment::removeExtension方法的具體用法?PHP Twig_Environment::removeExtension怎麽用?PHP Twig_Environment::removeExtension使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Twig_Environment的用法示例。


在下文中一共展示了Twig_Environment::removeExtension方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getEnvironment

 /**
  * Get (init if necessary) twig environment
  *
  * @param boolean $reset Force re-initialization (helpful for UTs)
  *
  * @return \Twig_Environment
  */
 protected function getEnvironment($reset = false)
 {
     if ($reset === true || null === $this->twig) {
         $this->twig = new \Twig_Environment($this->getLoader(), $this->getConfig());
         $this->twig->removeExtension('escaper');
     }
     return $this->twig;
 }
開發者ID:negativespace,項目名稱:phrozn,代碼行數:15,代碼來源:Twig.php

示例2: testRemoveExtension

 public function testRemoveExtension()
 {
     $twig = new Twig_Environment(new Twig_Loader_String());
     $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension());
     $twig->removeExtension('test');
     $this->assertFalse(array_key_exists('test', $twig->getTags()));
     $this->assertFalse(array_key_exists('foo_filter', $twig->getFilters()));
     $this->assertFalse(array_key_exists('foo_function', $twig->getFunctions()));
     $this->assertFalse(array_key_exists('foo_test', $twig->getTests()));
     $this->assertFalse(array_key_exists('foo_unary', $twig->getUnaryOperators()));
     $this->assertFalse(array_key_exists('foo_binary', $twig->getBinaryOperators()));
     $this->assertFalse(array_key_exists('foo_global', $twig->getGlobals()));
     $this->assertCount(2, $twig->getNodeVisitors());
 }
開發者ID:simonjodet,項目名稱:twig,代碼行數:14,代碼來源:EnvironmentTest.php

示例3: testRemoveExtension

 /**
  * @group legacy
  */
 public function testRemoveExtension()
 {
     $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
     $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension_WithDeprecatedName());
     $twig->removeExtension('environment_test');
     $this->assertFalse(array_key_exists('test', $twig->getTags()));
     $this->assertFalse(array_key_exists('foo_filter', $twig->getFilters()));
     $this->assertFalse(array_key_exists('foo_function', $twig->getFunctions()));
     $this->assertFalse(array_key_exists('foo_test', $twig->getTests()));
     $this->assertFalse(array_key_exists('foo_unary', $twig->getUnaryOperators()));
     $this->assertFalse(array_key_exists('foo_binary', $twig->getBinaryOperators()));
     $this->assertFalse(array_key_exists('foo_global', $twig->getGlobals()));
     $this->assertCount(2, $twig->getNodeVisitors());
 }
開發者ID:bigbitecreative,項目名稱:wordpress-git-content,代碼行數:17,代碼來源:EnvironmentTest.php


注:本文中的Twig_Environment::removeExtension方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。