Passed
Push — main ( 72c6fa...9344f0 )
by Sílvio
02:59
created

ConnectionException::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 4
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Silviooosilva\CacheerPhp\Exceptions;
4
5
use Exception;
6
7
class ConnectionException extends BaseException
8
{
9
10
  /** @param string $before */
11
  private static string $before = "<Connection Exception>";
12
13
  /**
14
  * @return void
15
  */
16
  public static function create(string $message = "", int $code = 0, ?Exception $previous = null, array $details = [])
17
  {
18
    return new self(self::getBefore() . ": " .$message, $code, $previous, $details);
0 ignored issues
show
Bug Best Practice introduced by
The expression return new self(self::ge...e, $previous, $details) returns the type Silviooosilva\CacheerPhp...ons\ConnectionException which is incompatible with the documented return type void.
Loading history...
19
  }
20
21
  /**
22
  * @return string
23
  */
24
  public static function getBefore()
25
  {
26
    return self::$before;
27
  }
28
29
  /**
30
  * @return void
31
  */
32
  public static function setBefore(string $text)
33
  {
34
    self::$before = $text;
35
  }
36
37
}
38