ILIAS  trunk Revision v12.0_alpha-16-g3e876e53c80
HelperImpl.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25
26class HelperImpl implements Helper
27{
28 public function __construct(
29 protected LOMServices $lom_services
30 ) {
31 }
32
33 public function readPresentableCopyright(int $obj_id, int $sub_id, string $type): string
34 {
35 if (!$this->supportsLOM($obj_id, $sub_id, $type)) {
36 return '';
37 }
38
39 $copyright_path = $this->lom_services->paths()->copyright();
40 $reader = $this->lom_services->read($obj_id, $sub_id, $type, $copyright_path);
41 if ($this->lom_services->copyrightHelper()->hasPresetCopyright($reader)) {
42 return $this->lom_services->copyrightHelper()->readPresetCopyright($reader)->title();
43 } else {
44 return $this->lom_services->copyrightHelper()->readCustomCopyright($reader);
45 }
46 }
47
53 protected function supportsLOM(int $obj_id, int $sub_id, string $type): bool
54 {
55 $title_path = $this->lom_services->paths()->title();
56 $reader = $this->lom_services->read($obj_id, $sub_id, $type, $title_path);
57 if ($reader->allData($title_path)->current() !== null) {
58 return true;
59 }
60 return false;
61 }
62}
readPresentableCopyright(int $obj_id, int $sub_id, string $type)
Definition: HelperImpl.php:33
supportsLOM(int $obj_id, int $sub_id, string $type)
There really should be better infrastructure in place to check what objects support LOM and which do ...
Definition: HelperImpl.php:53
__construct(protected LOMServices $lom_services)
Definition: HelperImpl.php:28