Passed
Push — master ( fa8c08...0a6b13 )
by Joachim
03:11
created

TemplateNotFoundException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 83.33%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 6
c 2
b 0
f 1
dl 0
loc 13
ccs 5
cts 6
cp 0.8333
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setono\PhpTemplates\Exception;
6
7
use InvalidArgumentException;
8
use function Safe\sprintf;
9
10
final class TemplateNotFoundException extends InvalidArgumentException implements ExceptionInterface
11
{
12 2
    public function __construct(string $template, array $paths)
13
    {
14 2
        $message = sprintf('The template, "%s" was not found.', $template);
15
16 2
        if (count($paths) > 0) {
17 2
            $message .= sprintf(' Looked inside these paths (in this order): %s', implode(', ', $paths));
18
        } else {
19
            $message .= ' No paths has been added to the engine. Use the Setono\PhpTemplates\Engine\EngineInterface::addPath() method to do so.';
20
        }
21
22 2
        parent::__construct($message);
23 2
    }
24
}
25