| Total Lines | 28 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 39 | public static function create($code, $message = null, $category = null) |
||
| 40 | { |
||
| 41 | return new class($message, $code, $category) extends ControlledError |
||
|
|
|||
| 42 | { |
||
| 43 | /** |
||
| 44 | * @var string |
||
| 45 | */ |
||
| 46 | protected $category; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @param string $message |
||
| 50 | * @param string $code |
||
| 51 | * @param null $category |
||
| 52 | */ |
||
| 53 | public function __construct($message, $code, $category = null) |
||
| 54 | { |
||
| 55 | if ($category) { |
||
| 56 | $this->category = $category; |
||
| 57 | } |
||
| 58 | parent:: __construct($message, $code); |
||
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @return string |
||
| 63 | */ |
||
| 64 | public function getCategory(): string |
||
| 65 | { |
||
| 66 | return $this->category ?? parent::getCategory(); |
||
| 67 | } |
||
| 71 |