You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.0 KiB
37 lines
1.0 KiB
<?php
|
|
/* For licensing terms, see /license.txt */
|
|
|
|
/**
|
|
* Class ImsLtiServiceRequestFactory.
|
|
*/
|
|
class ImsLtiServiceRequestFactory
|
|
{
|
|
/**
|
|
* @param SimpleXMLElement $xml
|
|
*
|
|
* @return ImsLtiServiceRequest|null
|
|
*/
|
|
public static function create(SimpleXMLElement $xml)
|
|
{
|
|
$bodyChildren = $xml->imsx_POXBody->children();
|
|
|
|
if (!empty($bodyChildren)) {
|
|
$name = $bodyChildren->getName();
|
|
|
|
switch ($name) {
|
|
case 'replaceResultRequest':
|
|
return new ImsLtiServiceReplaceRequest($xml);
|
|
case 'readResultRequest':
|
|
return new ImsLtiServiceReadRequest($xml);
|
|
case 'deleteResultRequest':
|
|
return new ImsLtiServiceDeleteRequest($xml);
|
|
default:
|
|
$name = str_replace(['ResultRequest', 'Request'], '', $name);
|
|
|
|
return new ImsLtiServiceUnsupportedRequest($xml, $name);
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
|