Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
28 | public function get($templateId) |
||
29 | { |
||
30 | if (!isset($this->config['layout'])) { |
||
31 | throw new Exception\TemplateNotCreatedException("Layouts not describes in config."); |
||
32 | } |
||
33 | if (!isset($this->config['templates'])) { |
||
34 | throw new Exception\TemplateNotExistsException("Templates not describes in config."); |
||
35 | } |
||
36 | if (!isset($this->config['templates'][$templateId])) { |
||
37 | throw new Exception\TemplateNotExistsException("Template $templateId does not exists."); |
||
38 | } |
||
39 | if (!isset($this->config['layout'][$this->config['templates'][$templateId]['layout']])) { |
||
40 | throw new Exception\TemplateNotCreatedException("Layout {$this->config['templates'][$templateId]['layout']} not describes in config."); |
||
41 | } |
||
42 | |||
43 | $viewLayout = new ViewModel(); |
||
44 | $viewLayout->setTemplate($this->config['layout'][$this->config['templates'][$templateId]['layout']]); |
||
45 | |||
46 | return new Template($templateId, $this->config['templates'][$templateId], $this->renderer, $viewLayout); |
||
47 | } |
||
48 | } |