TableNameNotFound   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 1
b 0
f 0
dl 0
loc 28
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A forKey() 0 8 1
A getKey() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ReliqArts\Logistiq\Utility\Exceptions;
6
7
use ReliqArts\Logistiq\Exception;
8
9
class TableNameNotFound extends Exception
10
{
11
    /**
12
     * @var null|string
13
     */
14
    private $key;
15
16
    /**
17
     * @param string $key
18
     *
19
     * @return self
20
     */
21
    public static function forKey(string $key): self
22
    {
23
        $message = sprintf('Table name for key: `%s` not found!', $key);
24
25
        $instance = new self($message);
26
        $instance->key = $key;
27
28
        return $instance;
29
    }
30
31
    /**
32
     * @return null|string
33
     */
34
    public function getKey(): ?string
35
    {
36
        return $this->key;
37
    }
38
}
39