ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ModeFactory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Survey\Mode;
22
26
31{
33 protected ?array $providers = null;
35
36 public function __construct()
37 {
38 }
39
41 {
42 $this->service = $service;
43 }
44 protected function initProviders(): void
45 {
46 if (is_null($this->providers)) {
47 $gui = $this->service->gui();
48 $this->providers = [
49 new Standard\ModeProvider($gui),
53 ];
54 }
55 }
56
57 public function getModeById(int $id): ModeProvider
58 {
59 $this->initProviders();
60 foreach ($this->providers as $provider) {
61 if ($provider->getId() === $id) {
62 $provider->setInternalService($this->service);
63 return $provider;
64 }
65 }
66 throw new ModeException("Unknown mode: " . $id);
67 }
68}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
setInternalService(InternalService $service)
$provider
Definition: ltitoken.php:80