ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\MetaData\OERExposer\OAIPMH\Handler Class Reference
+ Collaboration diagram for ILIAS\MetaData\OERExposer\OAIPMH\Handler:

Public Member Functions

 __construct ()
 
 sendResponseToRequest ()
 

Protected Member Functions

 logError (string $message)
 

Protected Attributes

InitiatorInterface $initiator
 
ilLogger $logger
 
readonly URI $base_url
 

Detailed Description

Definition at line 25 of file Handler.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MetaData\OERExposer\OAIPMH\Handler::__construct ( )

Definition at line 32 of file Handler.php.

33 {
34 global $DIC;
35
36 $this->logger = $DIC->logger()->meta();
37 $this->initiator = new Initiator($DIC);
38 $this->base_url = new URI(rtrim(ILIAS_HTTP_PATH, '/') . '/oai.php');
39 }
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
global $DIC
Definition: shib_login.php:26

References $DIC, and ILIAS\Repository\logger().

+ Here is the call graph for this function:

Member Function Documentation

◆ logError()

ILIAS\MetaData\OERExposer\OAIPMH\Handler::logError ( string  $message)
protected

Definition at line 67 of file Handler.php.

67 : void
68 {
69 $this->logger->error($message);
70 }
$message
Definition: xapiexit.php:31

References ILIAS\Repository\logger().

Referenced by ILIAS\MetaData\OERExposer\OAIPMH\Handler\sendResponseToRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendResponseToRequest()

ILIAS\MetaData\OERExposer\OAIPMH\Handler::sendResponseToRequest ( )

Definition at line 41 of file Handler.php.

41 : void
42 {
43 if (!$this->initiator->settings()->isOAIPMHActive()) {
44 $this->initiator->httpWrapper()->sendResponseAndClose(404);
45 return;
46 }
47
48 set_error_handler(static function (int $errno, string $errstr, string $errfile, int $errline): never {
49 throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
50 });
51
52 try {
53 $response = $this->initiator->requestProcessor()->getResponseToRequest(
54 $this->initiator->requestParser()->parseFromHTTP($this->base_url)
55 );
56 } catch (\Throwable $e) {
57 $this->logError($e->getMessage());
58 $this->initiator->httpWrapper()->sendResponseAndClose(500, $e->getMessage());
59 return;
60 } finally {
61 restore_error_handler();
62 }
63
64 $this->initiator->httpWrapper()->sendResponseAndClose(200, '', $response);
65 }
$response
Definition: xapitoken.php:93

References Vendor\Package\$e, $response, and ILIAS\MetaData\OERExposer\OAIPMH\Handler\logError().

+ Here is the call graph for this function:

Field Documentation

◆ $base_url

readonly URI ILIAS\MetaData\OERExposer\OAIPMH\Handler::$base_url
protected

Definition at line 30 of file Handler.php.

◆ $initiator

InitiatorInterface ILIAS\MetaData\OERExposer\OAIPMH\Handler::$initiator
protected

Definition at line 27 of file Handler.php.

◆ $logger

ilLogger ILIAS\MetaData\OERExposer\OAIPMH\Handler::$logger
protected

Definition at line 28 of file Handler.php.


The documentation for this class was generated from the following file: