TextFormatter: Remove a pointless type check
The function signature guarantees that this parameter can't be of any other type. Change-Id: I08f80e3ae7515f21f88b7f1f4f395ddbbb7b70ab
This commit is contained in:
parent
bcf2d4a7ac
commit
1a3a67d296
1 changed files with 13 additions and 17 deletions
|
|
@ -52,24 +52,20 @@ class TextFormatter implements ITextFormatter {
|
|||
$convertedElements[] = $this->convertParam( $element );
|
||||
}
|
||||
return Message::listParam( $convertedElements, $param->getListType() );
|
||||
} elseif ( $param instanceof MessageParam ) {
|
||||
$value = $param->getValue();
|
||||
if ( $value instanceof MessageValue ) {
|
||||
$mv = $value;
|
||||
$value = $this->createMessage( $mv->getKey() );
|
||||
foreach ( $mv->getParams() as $mvParam ) {
|
||||
$value->params( $this->convertParam( $mvParam ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $param->getType() === ParamType::TEXT ) {
|
||||
return $value;
|
||||
} else {
|
||||
return [ $param->getType() => $value ];
|
||||
}
|
||||
} else {
|
||||
throw new \InvalidArgumentException( 'Invalid message parameter type' );
|
||||
}
|
||||
$value = $param->getValue();
|
||||
if ( $value instanceof MessageValue ) {
|
||||
$mv = $value;
|
||||
$value = $this->createMessage( $mv->getKey() );
|
||||
foreach ( $mv->getParams() as $mvParam ) {
|
||||
$value->params( $this->convertParam( $mvParam ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $param->getType() === ParamType::TEXT ) {
|
||||
return $value;
|
||||
}
|
||||
return [ $param->getType() => $value ];
|
||||
}
|
||||
|
||||
public function format( MessageValue $mv ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue