Completed
Pull Request — 2.0.x (#6)
by Andrew
02:11
created

StaticPageContentView   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
c 2
b 0
f 1
lcom 1
cbo 2
dl 0
loc 20
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getTemplateName() 0 8 2
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