mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-05 00:59:35 +00:00
Configure a default fallback for getInput function
This commit is contained in:
parent
bedadbee38
commit
94004c5104
@ -54,7 +54,7 @@ class FeedReducerBridge extends FeedExpander {
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
$trimmedPercentage = preg_replace('/[^0-9]/', '', $this->getInput('percentage') || '');
|
||||
$trimmedPercentage = preg_replace('/[^0-9]/', '', $this->getInput('percentage', ''));
|
||||
return parent::getName() . ' [' . $trimmedPercentage . '%]';
|
||||
}
|
||||
}
|
||||
|
@ -291,11 +291,12 @@ abstract class BridgeAbstract implements BridgeInterface {
|
||||
* Returns the value for the provided input
|
||||
*
|
||||
* @param string $input The input name
|
||||
* @return mixed|null The input value or null if the input is not defined
|
||||
* @param string $default The default value, when input is not defined. Default to null
|
||||
* @return mixed The input value or the default value if the input is not defined
|
||||
*/
|
||||
protected function getInput($input){
|
||||
protected function getInput($input, $default = null){
|
||||
if(!isset($this->inputs[$this->queriedContext][$input]['value'])) {
|
||||
return null;
|
||||
return $default;
|
||||
}
|
||||
return $this->inputs[$this->queriedContext][$input]['value'];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user