Completed
Branch 2.0.x (e30486)
by Andrew
03:10
created

StaticPageContentView::getTemplateName()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 8
rs 9.4286
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
/**
4
 * @author     Andrew Coulton <[email protected]>
5
 * @copyright  2015 inGenerator Ltd
6
 * @license    http://kohanaframework.org/license
7
 */
8
namespace Ingenerator\KohanaView\ViewModel\PageLayout;
9
10
use Ingenerator\KohanaView\Exception\UnassignedViewVarException;
11
use Ingenerator\KohanaView\TemplateSpecifyingViewModel;
12
13
class StaticPageContentView extends AbstractPageContentView implements TemplateSpecifyingViewModel
14
{
15
    protected $variables = [
16
        'page_path' => NULL,
17
    ];
18
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function getTemplateName()
23
    {
24
        if ( ! $this->variables['page_path']) {
25
            throw UnassignedViewVarException::forVariable(static::class, 'page_path', 'name/of/view');
26
        }
27
28
        return $this->variables['page_path'];
29
    }
30
31
32
}
33