diff options
Diffstat (limited to 'library')
-rwxr-xr-x | library/SSRS/Report.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/library/SSRS/Report.php b/library/SSRS/Report.php index 521a5e8..8129b23 100755 --- a/library/SSRS/Report.php +++ b/library/SSRS/Report.php @@ -304,11 +304,13 @@ class Report { * @param string $id * @return SSRS\Object\ExecutionInfo */ - public function setExecutionParameters(ExecutionParameters $parameters, $parameterLanguage = 'en-us') { + public function setExecutionParameters($parameters, $parameterLanguage = 'en-us') { + $executionParameters = $this->factoryParameters($parameters); + $this->checkSessionId(); $options = array( - 'Parameters' => $parameters->getParameterArrayForSoapCall(), + 'Parameters' => $executionParameters->getParameterArrayForSoapCall(), 'ParameterLanguage' => $parameterLanguage, ); @@ -316,6 +318,18 @@ class Report { return new ExecutionInfo($result); } + protected function factoryParameters($parameters) { + if (is_array($parameters)) { + $parameters = new ExecutionParameters($parameters); + } + + if (false === $parameters instanceof ExecutionParameters) { + throw new InvalidArgumentException('Invalid execution parameters argument provided'); + } + + return $parameters; + } + /** * Renders and outputs report depending on $format variable. * |