MissingBlockException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 15
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A missingBlock() 0 7 2
1
<?php
2
3
namespace TheCodingMachine\Mail\Template;
4
5
class MissingBlockException extends \RuntimeException implements MailTemplateException
6
{
7
    /**
8
     * @param array $blockNames
9
     *
10
     * @return MissingBlockException
11
     */
12 1
    public static function missingBlock(array $blockNames):MissingBlockException
13
    {
14 1
        $blocksName = implode(',', $blockNames);
15 1
        $errorMsg = ($blocksName === '') ? 'No blocks found.' : 'Blocks found '.$blocksName.'.';
16
17 1
        return new self('Your template needs a subject block and a body_html or a body_text block.'.$errorMsg);
18
    }
19
}
20