| Conditions | 4 |
| Paths | 4 |
| Total Lines | 22 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | public function build($name, array $content) |
||
| 33 | { |
||
| 34 | foreach ($this->classMap as $key => $template) { |
||
| 35 | if ($template instanceof Template) { |
||
| 36 | throw new DomainException( |
||
| 37 | sprintf( |
||
| 38 | 'The given temple must be a %s instance, %s given', |
||
| 39 | Template::class, |
||
| 40 | get_class($template) |
||
| 41 | ) |
||
| 42 | ); |
||
| 43 | } |
||
| 44 | |||
| 45 | if ($template::name() === $name) { |
||
| 46 | return forward_static_call_array( |
||
| 47 | [$this->classMap[$key], 'fromContent'], |
||
| 48 | [new TemplateContent($content)] |
||
| 49 | ); |
||
| 50 | } |
||
| 51 | } |
||
| 52 | throw new TemplateNameDoesNotExistException($name); |
||
| 53 | } |
||
| 54 | } |
||
| 55 |