| @@ 126-139 (lines=14) @@ | ||
| 123 | } |
|
| 124 | } |
|
| 125 | ||
| 126 | private function getContextClass(string $contextId): string |
|
| 127 | { |
|
| 128 | if ($this->getContainer()->has($contextId)) { |
|
| 129 | return get_class($this->getContainer()->get($contextId)); |
|
| 130 | } |
|
| 131 | ||
| 132 | $class = '\\' . ltrim($contextId, '\\'); |
|
| 133 | ||
| 134 | if (class_exists($class)) { |
|
| 135 | return $class; |
|
| 136 | } |
|
| 137 | ||
| 138 | throw new \Exception('wtf?'); |
|
| 139 | } |
|
| 140 | ||
| 141 | private function getContext(string $contextId): Context |
|
| 142 | { |
|
| @@ 141-154 (lines=14) @@ | ||
| 138 | throw new \Exception('wtf?'); |
|
| 139 | } |
|
| 140 | ||
| 141 | private function getContext(string $contextId): Context |
|
| 142 | { |
|
| 143 | if ($this->getContainer()->has($contextId)) { |
|
| 144 | return $this->getContainer()->get($contextId); |
|
| 145 | } |
|
| 146 | ||
| 147 | $class = '\\' . ltrim($contextId, '\\'); |
|
| 148 | ||
| 149 | if (class_exists($class)) { |
|
| 150 | return new $class(); |
|
| 151 | } |
|
| 152 | ||
| 153 | throw new \Exception('wtf?'); |
|
| 154 | } |
|
| 155 | ||
| 156 | private function getContainer(): ContainerInterface |
|
| 157 | { |
|