| Total Complexity | 4 |
| Total Lines | 74 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | abstract class ImsLtiServiceRequest |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var string |
||
| 11 | */ |
||
| 12 | protected $responseType; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var SimpleXMLElement |
||
| 16 | */ |
||
| 17 | protected $xmlHeaderInfo; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var SimpleXMLElement |
||
| 21 | */ |
||
| 22 | protected $xmlRequest; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var ImsLtiServiceResponseStatus |
||
| 26 | */ |
||
| 27 | protected $statusInfo; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var mixed |
||
| 31 | */ |
||
| 32 | protected $responseBodyParam; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * ImsLtiServiceRequest constructor. |
||
| 36 | * |
||
| 37 | * @param SimpleXMLElement $xml |
||
| 38 | */ |
||
| 39 | public function __construct(SimpleXMLElement $xml) |
||
| 45 | } |
||
| 46 | |||
| 47 | protected function processHeader() |
||
| 48 | { |
||
| 49 | $info = $this->xmlHeaderInfo; |
||
| 50 | |||
| 51 | $this->statusInfo->setMessageRefIdentifier($info->imsx_messageIdentifier); |
||
| 52 | |||
| 53 | error_log("Service Request: tool version {$info->imsx_version} message ID {$info->imsx_messageIdentifier}"); |
||
| 54 | } |
||
| 55 | |||
| 56 | abstract protected function processBody(); |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @return ImsLtiServiceResponse|null |
||
| 60 | */ |
||
| 61 | private function generateResponse() |
||
| 62 | { |
||
| 63 | $response = ImsLtiServiceResponseFactory::create( |
||
| 64 | $this->responseType, |
||
| 65 | $this->statusInfo, |
||
| 66 | $this->responseBodyParam |
||
| 67 | ); |
||
| 68 | |||
| 69 | return $response; |
||
| 70 | } |
||
| 71 | |||
| 72 | /** |
||
| 73 | * @return ImsLtiServiceResponse|null |
||
| 74 | */ |
||
| 75 | public function process() |
||
| 81 | } |
||
| 82 | } |