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

StaticPageContentView   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

1 Method

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