当前位置: 首页>>代码示例>>PHP>>正文


PHP Twig_Loader_Filesystem::getPaths方法代码示例

本文整理汇总了PHP中Twig_Loader_Filesystem::getPaths方法的典型用法代码示例。如果您正苦于以下问题:PHP Twig_Loader_Filesystem::getPaths方法的具体用法?PHP Twig_Loader_Filesystem::getPaths怎么用?PHP Twig_Loader_Filesystem::getPaths使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Twig_Loader_Filesystem的用法示例。


在下文中一共展示了Twig_Loader_Filesystem::getPaths方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dump

 public function dump()
 {
     $finder = new Finder();
     $twigNamespaces = $this->loader->getNamespaces();
     foreach ($twigNamespaces as $ns) {
         if (count($this->loader->getPaths($ns)) > 0) {
             $iterator = $finder->files()->in($this->loader->getPaths($ns));
             foreach ($iterator as $file) {
                 /** @var SplFileInfo $file */
                 $resource = new TwigResource($this->loader, '@' . $ns . '/' . $file->getRelativePathname());
                 $this->lam->addResource($resource, 'twig');
             }
         }
     }
     foreach ($this->lam->getNames() as $name) {
         $asset = $this->lam->get($name);
         $formula = $this->lam->getFormula($name);
         $debug = isset($formula[2]['debug']) ? $formula[2]['debug'] : $this->lam->isDebug();
         $combine = isset($formula[2]['combine']) ? $formula[2]['combine'] : null;
         if (null !== $combine ? !$combine : $debug) {
             foreach ($asset as $leaf) {
                 $this->aw->writeAsset($leaf);
             }
         } else {
             $this->aw->writeAsset($asset);
         }
     }
 }
开发者ID:saxulum,项目名称:saxulum-assetic-twig-provider,代码行数:28,代码来源:Dumper.php

示例2: testPaths

 public function testPaths()
 {
     $basePath = dirname(__FILE__) . '/Fixtures';
     $loader = new Twig_Loader_Filesystem(array($basePath . '/normal', $basePath . '/normal_bis'));
     $loader->setPaths(array($basePath . '/named', $basePath . '/named_bis'), 'named');
     $loader->addPath($basePath . '/named_ter', 'named');
     $loader->addPath($basePath . '/normal_ter');
     $loader->prependPath($basePath . '/normal_final');
     $loader->prependPath($basePath . '/named_final', 'named');
     $this->assertEquals(array($basePath . '/normal_final', $basePath . '/normal', $basePath . '/normal_bis', $basePath . '/normal_ter'), $loader->getPaths());
     $this->assertEquals(array($basePath . '/named_final', $basePath . '/named', $basePath . '/named_bis', $basePath . '/named_ter'), $loader->getPaths('named'));
     $this->assertEquals("path (final)\n", $loader->getSource('index.html'));
     $this->assertEquals("path (final)\n", $loader->getSource('@__main__/index.html'));
     $this->assertEquals("named path (final)\n", $loader->getSource('@named/index.html'));
 }
开发者ID:alexBLR,项目名称:firmware,代码行数:15,代码来源:FilesystemTest.php

示例3: getPaths

 /**
  * Get the template directories
  *
  * @return TemplatePath[]
  */
 public function getPaths()
 {
     $paths = [];
     foreach ($this->twigLoader->getNamespaces() as $namespace) {
         $name = $namespace !== TwigFilesystem::MAIN_NAMESPACE ? $namespace : null;
         foreach ($this->twigLoader->getPaths($namespace) as $path) {
             $paths[] = new TemplatePath($path, $name);
         }
     }
     return $paths;
 }
开发者ID:weierophinney,项目名称:zend-expressive-twigrenderer,代码行数:16,代码来源:TwigRenderer.php

示例4: getTemplatePathname

 /**
  * Get a fully qualified path to a given template.
  * @param string $file Filename of the template to find in referenced templates directories.
  * @param string $namespace Namespace of a specific set of templates directories.
  * @return string The full pathname to the template or 'false' if not found.
  */
 public function getTemplatePathname($file, $namespace = false)
 {
     $pathname = false;
     if ($this->_loader->exists($file)) {
         $paths = StringUtils::emptyOrSpaces($namespace) ? $this->_loader->getPaths() : $this->_loader->getPaths(trim($namespace));
         foreach ($paths as $path) {
             $tmp_pathname = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . ltrim($file, DIRECTORY_SEPARATOR);
             if (file_exists($tmp_pathname)) {
                 $pathname = $tmp_pathname;
                 break;
             }
         }
     }
     return $pathname;
 }
开发者ID:bgillet,项目名称:slim-twig,代码行数:21,代码来源:TwigView.php

示例5: findTemplate

 /**
  * Determine the path of a template based on its name
  *
  * @param \Twig_Loader_Filesystem $filesystem
  * @param string                  $name
  *
  * @return string
  *
  * @throws Twig_Error_Loader
  */
 public static function findTemplate(\Twig_Loader_Filesystem $filesystem, $name)
 {
     $name = self::normalizeName($name);
     self::validateName($name);
     list($namespace, $shortname) = self::parseName($name);
     $paths = $filesystem->getPaths($namespace);
     if (empty($paths)) {
         throw new Twig_Error_Loader(sprintf('There are no registered paths for namespace "%s".', $namespace));
     }
     foreach ($paths as $path) {
         if (is_file($path . '/' . $shortname)) {
             if (false !== ($realpath = realpath($path . '/' . $shortname))) {
                 return $realpath;
             }
             return $path . '/' . $shortname;
         }
     }
     throw new Twig_Error_Loader(sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $paths)));
 }
开发者ID:jmversteeg,项目名称:jvwp,代码行数:29,代码来源:TemplateUtils.php

示例6: testEmptyConstructor

 public function testEmptyConstructor()
 {
     $loader = new Twig_Loader_Filesystem();
     $this->assertEquals(array(), $loader->getPaths());
 }
开发者ID:sharenjoy,项目名称:axes,代码行数:5,代码来源:FilesystemTest.php

示例7: getScriptPath

 /**
  * @return string
  */
 public function getScriptPath()
 {
     return $this->loader->getPaths();
 }
开发者ID:jsyzchen,项目名称:chen-yaf,代码行数:7,代码来源:Adapter.php

示例8: getScriptPath

 /**
  * @return string
  */
 public function getScriptPath()
 {
     $paths = $this->loader->getPaths();
     return reset($paths);
 }
开发者ID:lovelock,项目名称:yaf-twig-adapter,代码行数:8,代码来源:Twig.php

示例9: getPaths

 /**
  * Gets the paths of the rendering environment.
  *
  * @return mixed
  */
 public function getPaths()
 {
     return $this->twigFileLoader->getPaths();
 }
开发者ID:newup,项目名称:core,代码行数:9,代码来源:TemplateRenderer.php

示例10: getScriptPath

 /**
  * @return string
  */
 public function getScriptPath()
 {
     $this->script_path = $this->loader->getPaths();
     return reset($this->script_path);
 }
开发者ID:dalinhuang,项目名称:51mook,代码行数:8,代码来源:TwigAdapter.php


注:本文中的Twig_Loader_Filesystem::getPaths方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。