| 1 | <?php |
||
| 22 | class ExceptionValueMap |
||
| 23 | { |
||
| 24 | /** |
||
| 25 | * Map of values mapped to exception class |
||
| 26 | * key => exception class |
||
| 27 | * value => value associated with exception. |
||
| 28 | * |
||
| 29 | * @var array |
||
| 30 | */ |
||
| 31 | private $map; |
||
| 32 | |||
| 33 | /** |
||
| 34 | 15 | * @param array $map |
|
| 35 | */ |
||
| 36 | 15 | public function __construct(array $map) |
|
| 40 | |||
| 41 | /** |
||
| 42 | * Resolves the value corresponding to an exception object. |
||
| 43 | * |
||
| 44 | * @param \Exception $exception |
||
| 45 | * |
||
| 46 | 12 | * @return mixed|false Value found or false is not found |
|
| 47 | */ |
||
| 48 | 12 | public function resolveException(\Throwable $exception) |
|
| 52 | |||
| 53 | /** |
||
| 54 | * Resolves the value corresponding to an exception class. |
||
| 55 | * |
||
| 56 | * @param string $class |
||
| 57 | * |
||
| 58 | 12 | * @return mixed|false if not found |
|
| 59 | */ |
||
| 60 | 12 | private function doResolveClass($class) |
|
| 74 | } |
||
| 75 |