setDefaultValue() public method

Sets the default value of the argument
public setDefaultValue ( mixed $defaultValue ) : Argument
$defaultValue mixed Default value
return Argument $this
Esempio n. 1
0
 /**
  * @test
  */
 public function setDefaultValueShouldProvideFluentInterfaceAndReallySetDefaultValue()
 {
     $returnedArgument = $this->simpleValueArgument->setDefaultValue('default');
     $this->assertSame($this->simpleValueArgument, $returnedArgument, 'The returned argument is not the original argument.');
     $this->assertSame('default', $this->simpleValueArgument->getDefaultValue());
 }
 /**
  * Creates, adds and returns a new controller argument to this composite object.
  * If an argument with the same name exists already, it will be replaced by the
  * new argument object.
  *
  * @param string $name Name of the argument
  * @param string $dataType Name of one of the built-in data types
  * @param boolean $isRequired TRUE if this argument should be marked as required
  * @param mixed $defaultValue Default value of the argument. Only makes sense if $isRequired==FALSE
  * @return Argument The new argument
  * @api
  */
 public function addNewArgument($name, $dataType = 'string', $isRequired = true, $defaultValue = null)
 {
     $argument = new Argument($name, $dataType);
     $argument->setRequired($isRequired);
     $argument->setDefaultValue($defaultValue);
     $this->addArgument($argument);
     return $argument;
 }