Passed
Pull Request — master (#124)
by Dave
02:19
created

ArrayParseException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 19
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A missingKey() 0 3 1
A invalidType() 0 5 1
A invalidValue() 0 5 1
1
<?php
2
3
/**
4
 * Static Analysis Results Baseliner (sarb).
5
 *
6
 * (c) Dave Liddament
7
 *
8
 * For the full copyright and licence information please view the LICENSE file distributed with this source code.
9
 */
10
11
declare(strict_types=1);
12
13
namespace DaveLiddament\StaticAnalysisResultsBaseliner\Domain\Utils;
14
15
use DaveLiddament\StaticAnalysisResultsBaseliner\Domain\Common\SarbException;
16
17
class ArrayParseException extends SarbException
18
{
19
    public static function missingKey(string $key): self
20
    {
21
        return new self("Missing key [$key]");
22
    }
23
24
    public static function invalidType(string $key, string $expectedType): self
25
    {
26
        $message = "Value for [$key] is not of the expected type [$expectedType]";
27
28
        return new self($message);
29
    }
30
31
    public static function invalidValue(string $key, string $value): self
32
    {
33
        $message = "Value [$value] for [$key] is not valid";
34
35
        return new self($message);
36
    }
37
}
38