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


PHP BuilderConfiguration::getResources方法代碼示例

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


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

示例1: merge

 /**
  * Merges a BuilderConfiguration with the current one.
  *
  * @param BuilderConfiguration $configuration
  *
  * @return BuilderConfiguration The current instance
  */
 public function merge(BuilderConfiguration $configuration = null)
 {
     if (null === $configuration) {
         return;
     }
     $this->addDefinitions($configuration->getDefinitions());
     $this->addAliases($configuration->getAliases());
     $this->addParameters($configuration->getParameters());
     foreach ($configuration->getResources() as $resource) {
         $this->addResource($resource);
     }
     return $this;
 }
開發者ID:jacques-sounvi,項目名稱:addressbook,代碼行數:20,代碼來源:BuilderConfiguration.php

示例2: Definition

$configuration->setDefinition('foobar', $foo = new Definition('FooBarClass'));
$t->is($configuration->getDefinition('foobar'), $foo, '->getDefinition() returns a service definition if defined');
$t->ok($configuration->setDefinition('foobar', $foo = new Definition('FooBarClass')) === $foo, '->setDefinition() implements a fuild interface by returning the service reference');

$configuration->addDefinitions($defs = array('foobar' => new Definition('FooBarClass')));
$t->is($configuration->getDefinitions(), array_merge($definitions, $defs), '->addDefinitions() adds the service definitions');

try
{
  $configuration->getDefinition('baz');
  $t->fail('->getDefinition() throws an InvalidArgumentException if the service definition does not exist');
}
catch (InvalidArgumentException $e)
{
  $t->pass('->getDefinition() throws an InvalidArgumentException if the service definition does not exist');
}

// ->findDefinition()
$t->diag('->findDefinition()');
$configuration = new BuilderConfiguration(array('foo' => $definition = new Definition('FooClass')));
$configuration->setAlias('bar', 'foo');
$configuration->setAlias('foobar', 'bar');
$t->is($configuration->findDefinition('foobar'), $definition, '->findDefinition() returns a Definition');

// ->addResource() ->getResources()
$t->diag('->addResource() ->getResources()');
$configuration = new BuilderConfiguration();
$configuration->addResource($a = new FileResource('foo.xml'));
$configuration->addResource($b = new FileResource('foo.yml'));
$t->is($configuration->getResources(), array($a, $b), '->getResources() returns an array of resources read for the current configuration');
開發者ID:nicolasmartin,項目名稱:symfony,代碼行數:30,代碼來源:BuilderConfigurationTest.php

示例3: testResources

 public function testResources()
 {
     $configuration = new BuilderConfiguration();
     $configuration->addResource($a = new FileResource('foo.xml'));
     $configuration->addResource($b = new FileResource('foo.yml'));
     $this->assertEquals(array($a, $b), $configuration->getResources(), '->getResources() returns an array of resources read for the current configuration');
 }
開發者ID:jacques-sounvi,項目名稱:addressbook,代碼行數:7,代碼來源:BuilderConfigurationTest.php

示例4: testResources

 /**
  * @covers Symfony\Components\DependencyInjection\BuilderConfiguration::getResources
  * @covers Symfony\Components\DependencyInjection\BuilderConfiguration::addResource
  */
 public function testResources()
 {
     $configuration = new BuilderConfiguration();
     $configuration->addResource($a = new FileResource(self::$fixturesPath . '/xml/services1.xml'));
     $configuration->addResource($b = new FileResource(self::$fixturesPath . '/xml/services2.xml'));
     $this->assertEquals(array($a, $b), $configuration->getResources(), '->getResources() returns an array of resources read for the current configuration');
 }
開發者ID:bill97420,項目名稱:symfony,代碼行數:11,代碼來源:BuilderConfigurationTest.php


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