Completed
Push — 2.0.x ( f85be6...e30486 )
by Andrew
02:32
created

UnassignedViewVarException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A forVariable() 0 12 1
1
<?php
2
/**
3
 * @author     Andrew Coulton <[email protected]>
4
 * @copyright  2015 inGenerator Ltd
5
 * @license    http://kohanaframework.org/license
6
 */
7
8
namespace Ingenerator\KohanaView\Exception;
9
10
11
/**
12
 * Thrown when a required view variable has not been assigned before use
13
 *
14
 * @package Ingenerator\KohanaView\Exception
15
 */
16
class UnassignedViewVarException extends \BadMethodCallException
17
{
18
19
    /**
20
     * @param string $view_class
21
     * @param string $var_name
22
     * @param string $hint
23
     *
24
     * @return static
25
     */
26
    public static function forVariable($view_class, $var_name, $hint)
27
    {
28
        return new static(
29
            sprintf(
30
                'Call %s::display(["%s" => "%s"]) before rendering a %s view',
31
                $view_class,
32
                $var_name,
33
                $hint,
34
                $view_class
35
            )
36
        );
37
    }
38
39
40
}
41