/** * @see IParamDefinition::format * * @since 0.5 * * @param $param IParam * @param $definitions array of IParamDefinition * @param $params array of IParam */ public function format(IParam $param, array &$definitions, array $params) { if ($this->isList()) { $values = $param->getValue(); foreach ($values as &$value) { $value = $this->formatValue($value, $param, $definitions, $params); } $param->setValue($values); $this->formatList($param, $definitions, $params); } else { $param->setValue($this->formatValue($param->getValue(), $param, $definitions, $params)); } }
/** * Tries to find a matching user provided value and, when found, assigns it * to the parameter, and removes it from the raw values. Returns a boolean * indicating if there was any user value set or not. * * @since 0.4 * * @param IParam $param * * @return boolean */ protected function attemptToSetUserValue(IParam $param) { if (array_key_exists($param->getName(), $this->rawParameters)) { $param->setUserValue($param->getName(), $this->rawParameters[$param->getName()], $this->options); unset($this->rawParameters[$param->getName()]); return true; } else { foreach ($param->getDefinition()->getAliases() as $alias) { if (array_key_exists($alias, $this->rawParameters)) { $param->setUserValue($alias, $this->rawParameters[$alias], $this->options); unset($this->rawParameters[$alias]); return true; } } } return false; }
/** * @see IParamDefinition::format * * @since 1.0 * @deprecated * * @param IParam $param * @param IParamDefinition[] $definitions * @param IParam[] $params */ public function format(IParam $param, array &$definitions, array $params) { if ($this->isList()) { $values = $param->getValue(); foreach ($values as &$value) { $value = $this->formatValue($value, $param, $definitions, $params); } $param->setValue($values); $this->formatList($param, $definitions, $params); } else { $param->setValue($this->formatValue($param->getValue(), $param, $definitions, $params)); } // deprecated, deriving classes should not add array-definitions to the list $definitions = self::getCleanDefinitions($definitions); if (array_key_exists('post-format', $this->options)) { $param->setValue(call_user_func($this->options['post-format'], $param->getValue())); } }