mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-06 00:27:27 +02:00
@@ -294,6 +294,32 @@ abstract class BridgeAbstract implements BridgeInterface
|
||||
return $this->inputs[$this->queriedContext][$input]['value'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the key name of a given input
|
||||
* Can process multilevel arrays with two levels, the max level a list can have
|
||||
*
|
||||
* @param string $input The input name
|
||||
* @return string|null The accompaning key to a given input or null if the input is not defined
|
||||
*/
|
||||
public function getKey($input)
|
||||
{
|
||||
if (!isset($this->inputs[$this->queriedContext][$input]['value'])) {
|
||||
return null;
|
||||
}
|
||||
$needle = $this->inputs[$this->queriedContext][$input]['value'];
|
||||
foreach (static::PARAMETERS[$this->queriedContext][$input]['values'] as $first_level_key => $first_level_value) {
|
||||
if ($needle === (string)$first_level_value) {
|
||||
return $first_level_key;
|
||||
} elseif (is_array($first_level_value)) {
|
||||
foreach ($first_level_value as $second_level_key => $second_level_value) {
|
||||
if ($needle === (string)$second_level_value) {
|
||||
return $second_level_key;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bridge configuration value
|
||||
*/
|
||||
|
Reference in New Issue
Block a user