Passed
Push — master ( 70e762...4a2070 )
by Evgenii
01:13
created

BlockException::forEmptyName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Helick\Blocks\Exceptions;
4
5
use InvalidArgumentException;
6
7
final class BlockException extends InvalidArgumentException
8
{
9
    /**
10
     * @return BlockException
11
     */
12
    public static function forEmptyName(): self
13
    {
14
        return new static('You must set the block name before composing');
15
    }
16
17
    /**
18
     * @return BlockException
19
     */
20
    public static function forEmptyTemplate(): self
21
    {
22
        return new static('You must set the block template before rendering');
23
    }
24
25
    /**
26
     * @param string|string[] $template
27
     *
28
     * @return BlockException
29
     */
30
    public static function forNotFoundTemplate($template): self
31
    {
32
        return new static(strtr('The block template ":template" could not be found', [
33
            ':template' => implode(', ', (array)$template)
34
        ]));
35
    }
36
}
37