ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Factory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25
27{
28 public function __construct(
29 private readonly Filesystem $webDirectory,
30 private readonly FileUpload $uploadService,
31 private readonly \ilObjectDataCache $objectCache
32 ) {
33 }
34
35 public function getConfigurationByType(string $type): Configuration
36 {
37 switch ($type) {
38 case 'grp':
39 case 'root':
40 case 'cat':
41 case 'fold':
42 case 'crs':
43 case 'prg':
44 $configuration = new ContainerConfiguration();
45 break;
46
47 default:
48 $configuration = new Configuration();
49 break;
50 }
51
52 return $configuration;
53 }
54
55 public function getByObjId(int $objId, string $objType = ''): Custom
56 {
57 if ($objType === '') {
58 $objType = $this->objectCache->lookupType($objId);
59 }
60
61 return new Custom(
62 $this->webDirectory,
63 $this->uploadService,
64 $this->getConfigurationByType($objType),
65 $objId
66 );
67 }
68
69 public function getPresenterByObjId(int $objId, string $objType): Presenter
70 {
71 if ($objType === '') {
72 $objType = $this->objectCache->lookupType($objId);
73 }
74
75 switch ($objType) {
76 case 'catr':
77 case 'grpr':
78 case 'crsr':
79 $presenter = new ObjectReferenceCustomIconPresenter($objId, $this);
80 $presenter->init();
81 break;
82
83 default:
84 $presenter = new ObjectCustomIconPresenter($this->getByObjId($objId, $objType));
85 break;
86 }
87
88 return $presenter;
89 }
90}
__construct(private readonly Filesystem $webDirectory, private readonly FileUpload $uploadService, private readonly \ilObjectDataCache $objectCache)
Definition: Factory.php:28
class ilObjectDataCache
The filesystem interface provides the public interface for the Filesystem service API consumer.
Definition: Filesystem.php:37
$objId
Definition: xapitoken.php:57