TemplateNotFound   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get_tried() 0 4 1
A __construct() 0 16 2
1
<?php
2
3
/*
4
 * This file is part of the ICanBoogie package.
5
 *
6
 * (c) Olivier Laviale <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ICanBoogie\Render;
13
14
use ICanBoogie\Accessor\AccessorTrait;
15
16
/**
17
 * Exception throw when a template cannot be found.
18
 *
19
 * @property-read array $tried Tried pathname collection.
20
 */
21
class TemplateNotFound extends \LogicException implements Exception
22
{
23
    use AccessorTrait;
24
25
    /**
26
     * @var array
27
     */
28
    private $tried;
29
30
    /**
31
     * @return array
32
     */
33
    protected function get_tried()
34
    {
35
        return $this->tried;
36
    }
37
38
    public function __construct($message, array $tried, $code = 404, \Exception $exception = null)
39
    {
40
        $this->tried = $tried;
41
42
        if ($tried)
43
        {
44
            $tried = implode("\n", array_map(function ($v) { return "- $v"; }, $tried));
45
            $message .= " The following files were tried:\n\n" . $tried;
46
        }
47
        else
48
        {
49
            $message .= " Also, no possible files were specified.";
50
        }
51
52
        parent::__construct($message, $code, $exception);
53
    }
54
}
55