This commit is contained in:
Xes
2025-08-14 22:39:38 +02:00
parent 3641e93527
commit 5403f346e3
3370 changed files with 327179 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Class ImsLtiServiceRequestFactory.
*/
class ImsLtiServiceRequestFactory
{
/**
* @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;
}
}