本文整理汇总了PHP中Parameter::getDefault方法的典型用法代码示例。如果您正苦于以下问题:PHP Parameter::getDefault方法的具体用法?PHP Parameter::getDefault怎么用?PHP Parameter::getDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parameter
的用法示例。
在下文中一共展示了Parameter::getDefault方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getValueToUse
/**
* Returns the value to initially display with the input.
*
* @since 0.4.6
*
* @return string
*/
protected function getValueToUse() {
$value = $this->currentValue === false ? $this->param->getDefault() : $this->currentValue;
if ( $this->param->isList() && is_array( $value ) ) {
$value = implode( $this->param->getDelimiter(), $value );
}
return $value;
}
示例2: getDescriptionRow
/**
* Returns the wikitext for a table row describing a single parameter.
*
* @since 1.0
*
* @param Parameter $parameter
*
* @return string
*/
protected function getDescriptionRow(Parameter $parameter)
{
$description = $parameter->getMessage();
if ($description === false) {
$description = $parameter->getDescription();
if ($description === false) {
$description = '-';
}
} else {
$description = $this->msg($description);
}
$type = $parameter->getTypeMessage();
$default = $parameter->isRequired() ? "''" . $this->msg('validator-describe-required') . "''" : $parameter->getDefault();
if (is_array($default)) {
$default = implode(', ', $default);
} elseif (is_bool($default)) {
$default = $default ? 'yes' : 'no';
}
if ($default === '') {
$default = "''" . $this->msg('validator-describe-empty') . "''";
}
return <<<EOT
| {$parameter->getName()}
| {$type}
| {$default}
| {$description}
EOT;
}
示例3: getValueToUse
/**
* Returns the value to initially display with the input.
*
* @since 0.4.6
*
* @return mixed
*/
protected function getValueToUse()
{
return $this->currentValue === false ? $this->param->getDefault() : $this->currentValue;
}
示例4: getDescriptionRow
/**
* Returns the wikitext for a table row describing a single parameter.
*
* @since 1.6
*
* @param Parameter $parameter
* @param boolean $hasAliases
*
* @return string
*/
protected function getDescriptionRow(Parameter $parameter, $hasAliases)
{
if ($hasAliases) {
$aliases = $parameter->getAliases();
$aliases = count($aliases) > 0 ? implode(', ', $aliases) : '-';
}
$description = $parameter->getMessage();
if ($description === false) {
$description = $parameter->getDescription();
if ($description === false) {
$description = '-';
}
} else {
$description = $this->msg($description);
}
$type = $parameter->getTypeMessage();
$default = $parameter->isRequired() ? "''" . $this->msg('validator-describe-required') . "''" : $parameter->getDefault();
if (is_array($default)) {
$default = implode(', ', $default);
} elseif (is_bool($default)) {
$default = $default ? 'yes' : 'no';
}
if ($default === '') {
$default = "''" . $this->msg('validator-describe-empty') . "''";
}
return "| {$parameter->getName()}\n" . ($hasAliases ? '| ' . $aliases . "\n" : '') . <<<EOT
| {$type}
| {$default}
| {$description}
EOT;
}
示例5: newFromParameter
/**
* @deprecated Compatibility helper, will be removed in 0.7.
* @since 0.5
*
* @param Parameter $parameter
*
* @return IParamDefinition
*/
public static function newFromParameter(Parameter $parameter)
{
$def = self::newFromType($parameter->getType(), $parameter->getName(), $parameter->getDefault(), $parameter->getMessage() === false ? 'validator-message-nodesc' : $parameter->getMessage(), $parameter->isList());
$def->addAliases($parameter->getAliases());
$def->addCriteria($parameter->getCriteria());
$def->addManipulations($parameter->getManipulations());
$def->addDependencies($parameter->getDependencies());
$def->setDoManipulationOfDefault($parameter->applyManipulationsToDefault);
if ($parameter->isList()) {
$def->setDelimiter($parameter->getDelimiter());
}
$def->trimValue = $parameter->trimValue;
return $def;
}
示例6: getDescriptionRow
/**
* Returns the wikitext for a table row describing a single parameter.
*
* @since 0.4.3
*
* @param Parameter $parameter
* @param array $defaults
*
* @return string
*/
protected function getDescriptionRow(Parameter $parameter, array $defaults)
{
$aliases = $parameter->getAliases();
$aliases = count($aliases) > 0 ? implode(', ', $aliases) : '-';
$description = $parameter->getMessage();
if ($description === false) {
$description = $parameter->getDescription();
if ($description === false) {
$description = '-';
}
} else {
$description = $this->msg($description);
}
$type = $parameter->getTypeMessage();
$number = 0;
$isDefault = false;
foreach ($defaults as $default) {
$number++;
if ($default == $parameter->getName()) {
$isDefault = true;
break;
}
}
$default = $parameter->isRequired() ? "''" . $this->msg('validator-describe-required') . "''" : $parameter->getDefault();
if (is_array($default)) {
$default = implode(', ', $default);
} elseif (is_bool($default)) {
$default = $default ? 'yes' : 'no';
}
if ($default === '') {
$default = "''" . $this->msg('validator-describe-empty') . "''";
}
if (!$isDefault) {
$number = '-';
}
return <<<EOT
| {$number}
| {$parameter->getName()}
| {$aliases}
| {$type}
| {$default}
| {$description}
EOT;
}