Passed
Push — main ( cd5745...cfa081 )
by Sílvio
10:20 queued 07:29
created

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