Completed
Branch 2.0.x (e30486)
by Andrew
02:20
created

TemplateCacheException::cannotCreateDirectory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4286
cc 1
eloc 3
nc 1
nop 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 there are problems caching a template
13
 *
14
 * @package Ingenerator\KohanaView\Exception
15
 */
16
class TemplateCacheException extends \RuntimeException
17
{
18
    /**
19
     * @param string $path
20
     *
21
     * @return static
22
     */
23
    public static function cannotCreateDirectory($path)
24
    {
25
        return new static(
26
            "Cannot create template cache directory in '$path'"
1 ignored issue
show
Coding Style Best Practice introduced by
As per coding-style, please use concatenation or sprintf for the variable $path instead of interpolation.

It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.

// Instead of
$x = "foo $bar $baz";

// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
27
        );
28
    }
29
30
    /**
31
     * @param string $path
32
     *
33
     * @return static
34
     */
35
    public static function pathNotWriteable($path)
36
    {
37
        return new static("Cannot write to compiled template path '$path'");
1 ignored issue
show
Coding Style Best Practice introduced by
As per coding-style, please use concatenation or sprintf for the variable $path instead of interpolation.

It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.

// Instead of
$x = "foo $bar $baz";

// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
38
    }
39
40
}
41