| Total Complexity | 3 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | trait ViewTrait |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * The template directories |
||
| 12 | * |
||
| 13 | * @var array |
||
| 14 | */ |
||
| 15 | protected $aDirectories = []; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * The directory of the current template |
||
| 19 | * |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | protected $sDirectory = ''; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * The extension of the current template |
||
| 26 | * |
||
| 27 | * @var string |
||
| 28 | */ |
||
| 29 | protected $sExtension = ''; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Add a namespace to the view renderer |
||
| 33 | * |
||
| 34 | * @param string $sNamespace The namespace name |
||
| 35 | * @param string $sDirectory The namespace directory |
||
| 36 | * @param string $sExtension The extension to append to template names |
||
| 37 | * |
||
| 38 | * @return void |
||
| 39 | */ |
||
| 40 | public function addNamespace(string $sNamespace, string $sDirectory, string $sExtension = '') |
||
| 41 | { |
||
| 42 | $this->aDirectories[$sNamespace] = ['path' => $sDirectory, 'ext' => $sExtension]; |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Set the namespace of the template being rendered |
||
| 47 | * |
||
| 48 | * @param string $sNamespace The namespace name |
||
| 49 | * |
||
| 50 | * @return void |
||
| 51 | */ |
||
| 52 | public function setCurrentNamespace(string $sNamespace) |
||
| 62 | } |
||
| 63 | } |
||
| 65 |