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


PHP BuilderConfiguration::hasParameter方法代码示例

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


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

示例1: configLoad

 /**
  * Loads the Propel configuration.
  *
  * @param array $config A configuration array
  *
  * @return BuilderConfiguration A BuilderConfiguration instance
  */
 public function configLoad($config, BuilderConfiguration $configuration)
 {
     if (!$configuration->hasDefinition('propel')) {
         $loader = new XmlFileLoader(__DIR__ . '/../Resources/config');
         $configuration->merge($loader->load($this->resources['propel']));
     }
     if (!$configuration->hasParameter('propel.path')) {
         if (!isset($config['path'])) {
             throw new \InvalidArgumentException('The "path" parameter is mandatory.');
         }
         $configuration->setParameter('propel.path', $config['path']);
     }
     if (isset($config['path'])) {
         $configuration->setParameter('propel.path', $config['path']);
     }
     if (isset($config['phing_path'])) {
         $configuration->setParameter('propel.phing_path', $config['phing_path']);
     }
 }
开发者ID:klaasn,项目名称:symfony-sandbox,代码行数:26,代码来源:PropelExtension.php

示例2: BuilderConfiguration

$t->is($configuration->getParameter('FOO'), 'baz1', '->getParameter() converts the key to lowercase');

try
{
  $configuration->getParameter('baba');
  $t->fail('->getParameter() throws an \InvalidArgumentException if the key does not exist');
}
catch (\InvalidArgumentException $e)
{
  $t->pass('->getParameter() throws an \InvalidArgumentException if the key does not exist');
}

// ->hasParameter()
$t->diag('->hasParameter()');
$configuration = new BuilderConfiguration(array(), array('foo' => 'bar'));
$t->ok($configuration->hasParameter('foo'), '->hasParameter() returns true if a parameter is defined');
$t->ok($configuration->hasParameter('Foo'), '->hasParameter() converts the key to lowercase');
$t->ok(!$configuration->hasParameter('bar'), '->hasParameter() returns false if a parameter is not defined');

// ->addParameters()
$t->diag('->addParameters()');
$configuration = new BuilderConfiguration(array(), array('foo' => 'bar'));
$configuration->addParameters(array('bar' => 'foo'));
$t->is($configuration->getParameters(), array('foo' => 'bar', 'bar' => 'foo'), '->addParameters() adds parameters to the existing ones');
$configuration->addParameters(array('Bar' => 'fooz'));
$t->is($configuration->getParameters(), array('foo' => 'bar', 'bar' => 'fooz'), '->addParameters() converts keys to lowercase');

// ->setAlias() ->getAlias() ->hasAlias() ->getAliases() ->addAliases()
$t->diag('->setAlias() ->getAlias() ->hasAlias()');
$configuration = new BuilderConfiguration();
$configuration->setAlias('bar', 'foo');
开发者ID:nicolasmartin,项目名称:symfony,代码行数:31,代码来源:BuilderConfigurationTest.php

示例3: testHasParameter

 public function testHasParameter()
 {
     $configuration = new BuilderConfiguration(array(), array('foo' => 'bar'));
     $this->assertTrue($configuration->hasParameter('foo'), '->hasParameter() returns true if a parameter is defined');
     $this->assertTrue($configuration->hasParameter('Foo'), '->hasParameter() converts the key to lowercase');
     $this->assertFalse($configuration->hasParameter('bar'), '->hasParameter() returns false if a parameter is not defined');
 }
开发者ID:jacques-sounvi,项目名称:addressbook,代码行数:7,代码来源:BuilderConfigurationTest.php


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