ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

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

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  }
global $DIC
Definition: shib_login.php:22
+ 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.

References ILIAS\Repository\logger().

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

67  : void
68  {
69  $this->logger->error($message);
70  }
$message
Definition: xapiexit.php:31
+ 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.

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

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
+ 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: