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


PHP Option::setName方法代码示例

本文整理汇总了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);
 }
开发者ID:ben-pritchard,项目名称:allergen_avoider,代码行数:11,代码来源:OptionTest.php

示例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;
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:22,代码来源:ListOptions.php

示例3: testSetName

 /**
  * @covers Phossa\Console\Option::setName
  */
 public function testSetName()
 {
     $this->object->setName('test');
     $this->assertEquals('test', $this->object->getName());
 }
开发者ID:phossa,项目名称:phossa-console,代码行数:8,代码来源:OptionTest.php

示例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;
 }
开发者ID:anton87gp,项目名称:phing-drush-task,代码行数:92,代码来源:Task.php


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