ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ILIAS\MetaData\OERExposer\OAIPMH\Handler Class Reference
+ Inheritance diagram for ILIAS\MetaData\OERExposer\OAIPMH\Handler:
+ Collaboration diagram for ILIAS\MetaData\OERExposer\OAIPMH\Handler:

Public Member Functions

 __construct (protected ilLogger $logger, protected SettingsInterface $settings, protected HTTPWrapper $http_wrapper, protected RequestParser $request_parser, protected RequestProcessor $request_processor)
 
 sendResponseToRequest ()
 
 sendResponseToRequest ()
 

Protected Member Functions

 logError (string $message)
 

Protected Attributes

readonly URI $base_url
 

Detailed Description

Definition at line 32 of file Handler.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MetaData\OERExposer\OAIPMH\Handler::__construct ( protected ilLogger  $logger,
protected SettingsInterface  $settings,
protected HTTPWrapper  $http_wrapper,
protected RequestParser  $request_parser,
protected RequestProcessor  $request_processor 
)

Definition at line 36 of file Handler.php.

42 {
43 $this->base_url = new URI(rtrim(ILIAS_HTTP_PATH, '/') . '/oai.php');
44 }

Member Function Documentation

◆ logError()

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

Definition at line 72 of file Handler.php.

72 : void
73 {
74 $this->logger->error($message);
75 }

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 ( )

Implements ILIAS\MetaData\OERExposer\OAIPMH\HandlerInterface.

Definition at line 46 of file Handler.php.

46 : void
47 {
48 if (!$this->settings->isOAIPMHActive()) {
49 $this->http_wrapper->sendResponseAndClose(404);
50 return;
51 }
52
53 set_error_handler(static function (int $errno, string $errstr, string $errfile, int $errline): never {
54 throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
55 });
56
57 try {
58 $response = $this->request_processor->getResponseToRequest(
59 $this->request_parser->parseFromHTTP($this->base_url)
60 );
61 } catch (Throwable $e) {
62 $this->logError($e->getMessage());
63 $this->http_wrapper->sendResponseAndClose(500, $e->getMessage());
64 return;
65 } finally {
66 restore_error_handler();
67 }
68
69 $this->http_wrapper->sendResponseAndClose(200, '', $response);
70 }
$response
Definition: xapitoken.php:90

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

+ 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 34 of file Handler.php.


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