[Bridge] Add function to set inputs
This commit is contained in:
parent
37f269cf53
commit
c2e411ba82
1 changed files with 11 additions and 8 deletions
|
@ -242,6 +242,16 @@ abstract class BridgeAbstract implements BridgeInterface {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function setInputs(array $inputs){
|
||||||
|
foreach($inputs as $name => $value){
|
||||||
|
foreach(static::PARAMETERS as $context => $set){
|
||||||
|
if(array_key_exists($name, static::PARAMETERS[$context])){
|
||||||
|
$this->inputs[$context][$name]['value'] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function getQueriedContext(){
|
protected function getQueriedContext(){
|
||||||
$queriedContexts=array();
|
$queriedContexts=array();
|
||||||
foreach(static::PARAMETERS as $context=>$set){
|
foreach(static::PARAMETERS as $context=>$set){
|
||||||
|
@ -308,14 +318,7 @@ abstract class BridgeAbstract implements BridgeInterface {
|
||||||
$this->returnClientError('Invalid parameters value(s)');
|
$this->returnClientError('Invalid parameters value(s)');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate BridgeAbstract::parameters with sanitized data
|
$this->setInputs($inputs);
|
||||||
foreach($inputs as $name=>$value){
|
|
||||||
foreach(static::PARAMETERS as $context=>$set){
|
|
||||||
if(array_key_exists($name,static::PARAMETERS[$context])){
|
|
||||||
$this->inputs[$context][$name]['value']=$value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Guess the paramter context from input data
|
// Guess the paramter context from input data
|
||||||
$queriedContext=$this->getQueriedContext();
|
$queriedContext=$this->getQueriedContext();
|
||||||
|
|
Loading…
Reference in a new issue