changed arguments of the modescripptevents to strings

This commit is contained in:
kremsy
2017-04-13 22:59:41 +02:00
parent cffbc6cd89
commit 7835f89eae
3 changed files with 21 additions and 10 deletions

View File

@ -142,7 +142,7 @@ class Connection
* @param bool|callable $multicall True to queue the request or false to execute it immediately
* @return mixed
*/
protected function execute($methodName, $params=array(), $multicall=false)
public function execute($methodName, $params=array(), $multicall=false)
{
if($multicall)
{
@ -2687,14 +2687,22 @@ class Connection
function triggerModeScriptEvent($event, $params='', $multicall=false)
{
if(!is_string($event))
throw new InvalidArgumentException('event = '.print_r($event, true));
throw new InvalidArgumentException('event name must be a string: event = '.print_r($event, true));
if(is_string($params))
return $this->execute(ucfirst(__FUNCTION__), array($event, $params), $multicall);
if(is_array($params))
if(is_array($params)){
foreach($params as $param){
if(!is_string($param)){
throw new InvalidArgumentException('argument must be a string: param = '.print_r($param, true));
}
}
return $this->execute(ucfirst(__FUNCTION__).'Array', array($event, $params), $multicall);
}
// else
throw new InvalidArgumentException('params = '.print_r($params, true));
throw new InvalidArgumentException('argument must be string or string[]: params = '.print_r($params, true));
}
/**