ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
PreProcessorManagerImpl.php
Go to the documentation of this file.
1 <?php
2 
20 
24 
38 {
42  private array $processors = [];
43 
47  public function with(PreProcessor $processor): void
48  {
49  $this->processors[] = $processor;
50  }
51 
52 
56  public function process(FileStream $stream, Metadata $metadata): ProcessingStatus
57  {
58  try {
59  $result = null;
60  foreach ($this->processors as $processor) {
61  $stream->rewind();
62  $result = $processor->process($stream, $metadata);
63  if ($result->getCode() === ProcessingStatus::REJECTED || $result->getCode() === ProcessingStatus::DENIED) {
64  return $result;
65  }
66  }
67 
68  if (is_null($result)) {
69  return new ProcessingStatus(ProcessingStatus::OK, 'No processors were registered.');
70  }
71 
72  return $result;
73  } catch (\Exception $ex) {
74  return new ProcessingStatus(ProcessingStatus::REJECTED, 'Processor failed with exception message "' . $ex->getMessage() . '"');
75  }
76  }
77 }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...