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

InvalidTemplateContentException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A containsImplicitDoubleEscape() 0 6 1
A forEmptyTemplate() 0 4 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 the content of a template is not valid for some reason
13
 *
14
 * @package Ingenerator\KohanaView\Exception
15
 */
16
class InvalidTemplateContentException extends \InvalidArgumentException
17
{
18
    /**
19
     * @param string $escape_method
20
     * @param string $source_fragment
21
     *
22
     * @return static
23
     */
24
    public static function containsImplicitDoubleEscape($escape_method, $source_fragment)
25
    {
26
        return new static(
27
            "Invalid implicit double-escape in template - remove $escape_method from `$source_fragment` or mark as raw"
28
        );
29
    }
30
31
    public static function forEmptyTemplate()
32
    {
33
        return new static('Cannot compile empty template');
34
    }
35
36
}
37