Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
18 / 18 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| _FileSysXData | |
100.00% |
18 / 18 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| getLocalXCodes | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
1 | |||
| getXMessageTemplates | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package pvcErr |
| 5 | * @author: Doug Wilbourne (dougwilbourne@gmail.com) |
| 6 | * @noinspection PhpCSValidationInspection |
| 7 | */ |
| 8 | |
| 9 | declare(strict_types=1); |
| 10 | |
| 11 | namespace pvc\storage\filesys\err; |
| 12 | |
| 13 | use pvc\err\XDataAbstract; |
| 14 | use pvc\interfaces\err\XDataInterface; |
| 15 | |
| 16 | /** |
| 17 | * Class _PvcExceptionLibrary |
| 18 | * @package pvcErr |
| 19 | */ |
| 20 | class _FileSysXData extends XDataAbstract implements XDataInterface |
| 21 | { |
| 22 | /** |
| 23 | * @function getLocalXCodes |
| 24 | * @return array<class-string, int> |
| 25 | */ |
| 26 | public function getLocalXCodes(): array |
| 27 | { |
| 28 | return [ |
| 29 | FileDoesNotExistException::class => 1000, |
| 30 | FileGetContentsException::class => 1001, |
| 31 | FileNotReadableException::class => 1002, |
| 32 | FileOpenException::class => 1003, |
| 33 | InvalidFileHandleException::class => 1004, |
| 34 | InvalidFileModeException::class => 1005, |
| 35 | InvalidFileNameException::class => 1006, |
| 36 | ]; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * @function getLocalXMessages |
| 41 | * @return array<class-string, string> |
| 42 | */ |
| 43 | public function getXMessageTemplates(): array |
| 44 | { |
| 45 | return [ |
| 46 | FileDoesNotExistException::class => 'File ${filePath} does not exist.', |
| 47 | FileGetContentsException::class => 'File ${filePath} exists and is readable but get_file_contents failed.', |
| 48 | FileNotReadableException::class => 'File ${filePath} is not readable.', |
| 49 | FileOpenException::class => 'File ${filePath} exists cannot be opened in mode ${mode}.', |
| 50 | InvalidFileHandleException::class => 'Resource is not a handle to a stream resource.', |
| 51 | InvalidFileModeException::class => '${badFileMode} is not a valid mode for opening a file.', |
| 52 | InvalidFileNameException::class => 'filename ${badFileName} is not a valid file name.', |
| 53 | ]; |
| 54 | } |
| 55 | } |