本文整理匯總了PHP中Foo::setBar方法的典型用法代碼示例。如果您正苦於以下問題:PHP Foo::setBar方法的具體用法?PHP Foo::setBar怎麽用?PHP Foo::setBar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Foo
的用法示例。
在下文中一共展示了Foo::setBar方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
/**
* Returns a collection of Foo instances according to
* the configuration section.
*/
public function &process(__ConfigurationSection &$section)
{
$return_value = array();
$foobars = $section->getSections();
foreach ($foobars as &$foobar) {
$foo = new Foo();
$foo->setBar($foobar->getAttribute('bar'));
$return_value[] = $foo;
}
return $return_value;
}
示例2: getFooWithInlineService
/**
* Gets the 'foo_with_inline' service.
*
* This service is shared.
* This method always returns the same instance of the service.
*
* @return \Foo A Foo instance.
*/
protected function getFooWithInlineService()
{
$this->services['foo_with_inline'] = $instance = new \Foo();
$instance->setBar($this->get('inlined'));
return $instance;
}
示例3: getFooWithInlineService
/**
* Gets the 'foo_with_inline' service.
*
* This service is shared.
* This method always returns the same instance of the service.
*
* @return \Foo A Foo instance
*/
protected function getFooWithInlineService()
{
$a = new \Bar();
$this->services['foo_with_inline'] = $instance = new \Foo();
$a->setBaz($this->get('baz'));
$a->pub = 'pub';
$instance->setBar($a);
return $instance;
}
示例4: getFooWithInlineService
/**
* Gets the 'foo_with_inline' service.
*
* This service is shared.
* This method always returns the same instance of the service.
*
* @return \Foo A Foo instance
*/
protected function getFooWithInlineService()
{
$this->services['foo_with_inline'] = $instance = new \Foo();
$instance->setBar(${($_ = isset($this->services['inlined']) ? $this->services['inlined'] : $this->getInlinedService()) && false ?: '_'});
return $instance;
}
示例5: Foo
<?php
require_once 'pb_proto_foo.php';
$foo = new Foo();
$foo->setBar(1);
$foo->setBaz('two');
$foo->appendSpam(3.0);
$foo->appendSpam(4.0);
$packed = $foo->serializeToString();
$foo->reset();
try {
$foo->parseFromString($packed);
} catch (Exception $ex) {
die('Upss.. there is a bug in this example');
}
$foo->dump();