Beispiel #1
0
 /**
  * Add a value to the appropriate field
  *
  * @param string $name The name of the argument
  * @param string $value The perceived value of the argument
  * @param string $next The next argument
  * @return integer The number to advance the counter
  */
 private function processNamedArgument($name, $value, $next)
 {
     if (($field = $this->fieldCollection->getField($name)) === null) {
         throw new UnknownFieldException("unknown option '{$name}'");
     }
     if ($field instanceof BooleanField || $next === null || $next[0] === '-') {
         $field->addValue($value);
         $ret = 0;
     } else {
         $field->addValue($next);
         $ret = 1;
     }
     $dataKey = constant(get_class($this->fieldCollection) . '::EVENT_DATA_KEY');
     $field->fire('parse', [$dataKey => $this->fieldCollection, 'field' => $field, 'name' => $name]);
     return $ret;
 }
Beispiel #2
0
 /**
  * Create the task and optionally add fields to it
  *
  * @param array.<sndsgd\Field> $fields 
  */
 public function __construct(array $fields = [])
 {
     parent::__construct($fields);
 }