本文整理汇总了PHP中Option::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Option::setName方法的具体用法?PHP Option::setName怎么用?PHP Option::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Option
的用法示例。
在下文中一共展示了Option::setName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetOptionName
function testSetOptionName()
{
//arrange
$name = "peanut allergy";
$test_allergy = new Option($name);
//act
$test_allergy->setName("peanut allergy");
$result = $test_allergy->getName();
//assert
$this->assertEquals("peanut allergy", $result);
}
示例2: getListOptions
/**
* @param $renderApi
* @param $unit
* @return IOptionProvider
*/
public function getListOptions($renderApi, $unit)
{
$options = preg_split('/\\n/', $renderApi->getFormValue($unit, 'listFieldOptions'));
foreach ($options as $option) {
$checked = false;
if (preg_match('/\\*$/', $option)) {
$checked = true;
$option = preg_replace('/\\*$/', '', $option);
}
$optionObj = new \Option();
$optionObj->setName($option);
$optionObj->setValue($option);
$optionObj->setChecked($checked);
$this->optionProvider->addOption($optionObj);
}
return $this->optionProvider;
}
示例3: testSetName
/**
* @covers Phossa\Console\Option::setName
*/
public function testSetName()
{
$this->object->setName('test');
$this->assertEquals('test', $this->object->getName());
}
示例4: main
/**
* The main entry point method.
*/
public function main()
{
$command = array();
$command[] = !empty($this->bin) ? $this->bin : 'drush';
if (!empty($this->alias)) {
$command[] = $this->alias;
}
if (empty($this->color)) {
$option = new Option();
$option->setName('nocolor');
$this->options[] = $option;
}
if (!empty($this->root)) {
$option = new Option();
$option->setName('root');
$option->addText($this->root);
$this->options[] = $option;
}
if (!empty($this->uri)) {
$option = new Option();
$option->setName('uri');
$option->addText($this->uri);
$this->options[] = $option;
}
if (!empty($this->config)) {
$option = new Option();
$option->setName('config');
$option->addText($this->config);
$this->options[] = $option;
}
if (!empty($this->aliasPath)) {
$option = new Option();
$option->setName('alias-path');
$option->addText($this->aliasPath);
$this->options[] = $option;
}
if (is_bool($this->assume)) {
$option = new Option();
$option->setName($this->assume ? 'yes' : 'no');
$this->options[] = $option;
}
if ($this->simulate) {
$option = new Option();
$option->setName('simulate');
$this->options[] = $option;
}
if ($this->pipe) {
$option = new Option();
$option->setName('pipe');
$this->options[] = $option;
}
if ($this->verbose) {
$option = new Option();
$option->setName('verbose');
$this->options[] = $option;
}
foreach ($this->options as $option) {
$command[] = $option->toString();
}
$command[] = $this->command;
foreach ($this->params as $param) {
$command[] = '"' . escapeshellcmd($param->getValue()) . '"';
}
$command = implode(' ', $command);
if ($this->dir !== NULL) {
$currdir = getcwd();
@chdir($this->dir->getPath());
}
// Execute Drush.
$this->log("Executing '{$command}'...");
$output = array();
exec($command, $output, $return);
if (isset($currdir)) {
@chdir($currdir);
}
// Collect Drush output for display through Phing's log.
foreach ($output as $line) {
$this->log($line);
}
// Set value of the 'pipe' property.
if (!empty($this->returnProperty)) {
$this->getProject()->setProperty($this->returnProperty, implode($this->returnGlue, $output));
}
// Build fail.
if ($this->haltOnError && $return != 0) {
throw new \BuildException("Drush exited with code {$return}");
}
return $return != 0;
}