CacheRedisException   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 55
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 3 1
A setBefore() 0 3 1
A toJson() 0 3 1
A jsonSerialize() 0 3 1
A toArray() 0 3 1
A getBefore() 0 3 1
1
<?php
2
3
namespace Silviooosilva\CacheerPhp\Exceptions;
4
5
use Exception;
6
7
class CacheRedisException extends BaseException
8
{
9
    private static string $before = "<Redis Cache Store Exception>";
10
11
    /**
12
     * @param string $message
13
     * @param int $code
14
     * @param Exception|null $previous
15
     * @param array $details
16
     * @return self
17
     */
18
    public static function create(string $message = "", int $code = 0, ?Exception $previous = null, array $details = [])
19
    {
20
        return new self(self::getBefore() . ": " . $message, $code, $previous, $details);
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    public static function getBefore(): string
27
    {
28
        return self::$before;
29
    }
30
31
    /**
32
     * @param string $text
33
     */
34
    public static function setBefore(string $text): void
35
    {
36
        self::$before = $text;
37
    }
38
39
    /*
40
    * @return array
41
    */
42
    public function toArray()
43
    {
44
        return parent::toArray();
45
    }
46
    
47
    /**
48
     * @return string
49
     */
50
    public function jsonSerialize(): array
51
    {
52
        return parent::jsonSerialize();
53
    }
54
55
    /**
56
     * @param int $options
57
     * @return string
58
     */
59
    public function toJson(int $options = 0)
60
    {
61
      return parent::toJson($options);
62
    }
63
}
64
65