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

StaticPageContentView::getTemplateName()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 10
rs 9.4286
cc 2
eloc 5
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\TemplateSpecifyingViewModel;
11
12
class StaticPageContentView extends AbstractPageContentView implements TemplateSpecifyingViewModel
13
{
14
    protected $variables = [
15
        'page_path' => NULL,
16
    ];
17
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function getTemplateName()
22
    {
23
        if ( ! $this->variables['page_path']) {
24
            throw new \BadMethodCallException(
25
                'Call '.static::class.'::display(["page_path" => "name/of/view"]) before rendering static views'
26
            );
27
        }
28
29
        return $this->variables['page_path'];
30
    }
31
32
33
}
34