Пример #1
0
 /**
  * Execute choreography with defined/allowed inputs.
  *
  * @param array|stdClass $userInputs Inputs supplied by JS library request.
  * @param array|stdClass $outputFilters Output filters supplied by JS library request.
  * @return Temboo_Choreography_Execution execution resource.
  * @throws Temboo_Exception_DisallowedInput if JS-supplied input is not allowed.
  * @throws Temboo_Exception_Authentication if session authentication fails.
  * @throws Temboo_Exception_Execution if runtime errors occur in synchronous execution or execution fails to start.
  * @throws Temboo_Exception_Notfound if choreography does not exist.
  * @throws Temboo_Exception if execution request fails.
  */
 public function execute($userInputs = array(), $outputFilters = array(), $clientVersion)
 {
     $fullInputs = clone $this->_inputs;
     if (is_object($userInputs)) {
         $userInputs = get_object_vars($userInputs);
         // For JSON object deoding.
     }
     foreach ($userInputs as $key => $value) {
         if (!in_array($key, $this->_allowedUserInputs)) {
             throw new Temboo_Exception_DisallowedInput('Input not allowed.', $key);
         }
         $fullInputs->set($key, $value);
     }
     foreach ($outputFilters as $name => $props) {
         $fullInputs->addOutputFilter($name, $props->path, $props->variable);
     }
     $this->_choreo->setJSClientVersion($clientVersion);
     return $this->_choreo->execute($fullInputs);
 }