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


PHP LoaderInterface::supports方法代码示例

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


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

示例1: testSupports

 public function testSupports()
 {
     $this->assertTrue($this->loader->supports('Resources/test.yml'));
     $this->assertTrue($this->loader->supports('Resources/test.yml', 'yaml'));
     $this->assertFalse($this->loader->supports('Resources/test.xml'));
     $this->assertFalse($this->loader->supports('Resources/test.xml', 'yaml'));
     $this->assertFalse($this->loader->supports('Resources/test'));
     $this->assertFalse($this->loader->supports('Resources/test', 'yaml'));
     $this->assertFalse($this->loader->supports('Resources/test.yaml', 'yaml'));
     $this->assertFalse($this->loader->supports('Resources/test.yaml'));
 }
开发者ID:bretanac93,项目名称:event,代码行数:11,代码来源:YamlFileLoaderTest.php

示例2: load

 /**
  * Loads the configuration data from a resource.
  *
  * @param mixed   $resource A resource.
  * @param string  $type     The resource type.
  * @param boolean $require  Require processing?
  *
  * @return array The data.
  *
  * @throws LoaderException If the loader could not be used.
  * @throws LogicException  If no loader has been configured.
  */
 public function load($resource, $type = null, $require = false)
 {
     if (null === $this->loader) {
         throw new LogicException('No loader has been configured.');
     }
     if (false === $this->loader->supports($resource, $type)) {
         throw LoaderException::format('The resource "%s"%s is not supported by the loader.', is_scalar($resource) ? $resource : gettype($resource), $type ? " ({$type})" : '');
     }
     if ($this->cacheDir && $this->collector && is_string($resource) && false === strpos("\n", $resource) && false === strpos("\r", $resource)) {
         $cache = new ConfigCache($this->cacheDir . DIRECTORY_SEPARATOR . basename($resource) . '.cache', $this->debug);
         if ($cache->isFresh()) {
             if (method_exists($cache, 'getPath')) {
                 /** @noinspection PhpIncludeInspection */
                 return require $cache->getPath();
             }
             /** @noinspection PhpIncludeInspection */
             return require $cache;
         }
     }
     if ($this->collector) {
         $this->collector->clearResources();
     }
     $data = $this->process($this->loader->load($resource, $type), $resource, $type, $require);
     if (isset($cache)) {
         $cache->write('<?php return ' . var_export($data, true) . ';', $this->collector->getResources());
     }
     return $data;
 }
开发者ID:ticketscript,项目名称:php-wise,代码行数:40,代码来源:Wise.php

示例3: supports

 /**
  * Returns whether this class supports the given resource.
  *
  * @param mixed       $resource A resource
  * @param string|null $type     The resource type or null if unknown
  *
  * @return bool True if this class supports the given resource, false otherwise
  */
 public function supports($resource, $type = null)
 {
     return $this->routerLoader->supports($resource, $type);
 }
开发者ID:thormeier,项目名称:breadcrumb-bundle,代码行数:12,代码来源:BreadcrumbAttachLoader.php


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