Skip to content

Commit

Permalink
Changes on commands get and set in response.
Browse files Browse the repository at this point in the history
  • Loading branch information
feuzeu committed Dec 27, 2019
1 parent f4995a5 commit 83f02ad
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/Response/Response.php
Expand Up @@ -246,15 +246,15 @@ public function addPluginCommand($xPlugin, $aAttributes, $mData)
* Merge the response commands from the specified <Response> object with
* the response commands in this <Response> object
*
* @param AbstractResponse $mCommands The <Response> object
* @param boolean $bBefore Add the new commands to the beginning of the list
* @param AbstractResponse|array $mCommands The <Response> object
* @param boolean $bBefore Add the new commands to the beginning of the list
*
* @return void
*/
public function appendResponse(AbstractResponse $mCommands, $bBefore = false)
public function appendResponse($mCommands, $bBefore = false)
{
$aCommands = [];
if($mCommands instanceof Response)
if($mCommands instanceof AbstractResponse)
{
$this->returnValue = $mCommands->returnValue;
$aCommands = $mCommands->aCommands;
Expand All @@ -265,10 +265,7 @@ public function appendResponse(AbstractResponse $mCommands, $bBefore = false)
}
else
{
if(!empty($mCommands))
{
throw new \Jaxon\Exception\Error(jaxon_trans('errors.response.data.invalid'));
}
throw new \Jaxon\Exception\Error(jaxon_trans('errors.response.data.invalid'));
}

if(count($aCommands) > 0)
Expand All @@ -284,6 +281,16 @@ public function appendResponse(AbstractResponse $mCommands, $bBefore = false)
}
}

/**
* Get the commands in the response
*
* @return array
*/
public function getCommands()
{
return $this->aCommands;
}

/**
* Get the number of commands in the response
*
Expand Down

0 comments on commit 83f02ad

Please sign in to comment.