forked from marcelog/PAMI
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use CommandResponse to process results coming back from CommandAction
Update Tests to Reflect new CommandResponse Handling references (marcelog#182) references (marcelog#88)
- Loading branch information
Showing
4 changed files
with
226 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
/** | ||
* A generic SCCP response message from ami. | ||
* | ||
* PHP Version 5 | ||
* | ||
* @category Pami | ||
* @package Message | ||
* @subpackage Response | ||
* @author Diederik de Groot <[email protected]> | ||
* @license http://marcelog.github.com/PAMI/ Apache License 2.0 | ||
* @version SVN: $Id$ | ||
* @link http://marcelog.github.com/PAMI/ | ||
* | ||
* Copyright 2019 Diederik de Groot <[email protected]> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
namespace PAMI\Message\Response; | ||
|
||
use PAMI\Message\Response\Response; | ||
use PAMI\Message\Event\EventMessage; | ||
use PAMI\Exception\PAMIException; | ||
|
||
/** | ||
* A generic SCCP response message from ami. | ||
* | ||
* PHP Version 5 | ||
* | ||
* @category Pami | ||
* @package Message | ||
* @subpackage Response | ||
* @author Marcelo Gornstein <[email protected]> | ||
* @license http://marcelog.github.com/PAMI/ Apache License 2.0 | ||
* @link http://marcelog.github.com/PAMI/ | ||
*/ | ||
class CommandResponse extends Response | ||
{ | ||
/** | ||
* Returns true if this response contains the Message: command output follow | ||
* | ||
* @return boolean | ||
*/ | ||
public function isCommandFinished() | ||
{ | ||
return stristr($this->getMessage(), 'command output follow') !== false; | ||
} | ||
|
||
/** | ||
* Returns Command output result | ||
* | ||
* @return string | ||
*/ | ||
public function getCommandOutput() | ||
{ | ||
return (string) $this->getKey('Output'); | ||
} | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param string $rawContent Literal message as received from ami. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct($rawContent) | ||
{ | ||
parent::__construct($rawContent); | ||
$this->completed = $this->isCommandFinished(); | ||
} | ||
} |
Oops, something went wrong.