summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArron Woods <aw@chartblocks.com>2015-04-15 13:13:26 +0100
committerArron Woods <aw@chartblocks.com>2015-04-15 13:13:26 +0100
commit53d161d414ed923d828bca529c02da295f6395a4 (patch)
tree492a6820d257605a194a89ff2102d6b7e3bd59a4
parent8a07ff8f6636a5a6f8deb6b5b048dcee14870d7f (diff)
downloadphp-ssrs-53d161d414ed923d828bca529c02da295f6395a4.zip
php-ssrs-53d161d414ed923d828bca529c02da295f6395a4.tar.gz
php-ssrs-53d161d414ed923d828bca529c02da295f6395a4.tar.bz2
Accept an array of execution parameters
-rwxr-xr-xlibrary/SSRS/Report.php18
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.
*