| 1 | <?php |
||
| 16 | abstract class AbstractTextFileValidator |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | private $allowedMimeType = 'text/plain'; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @return bool |
||
| 25 | */ |
||
| 26 | abstract public function validate(); |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @throws InvalidFileLocationException If file not exists |
||
| 30 | */ |
||
| 31 | protected function validateFileLocation() |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @throws InvalidFileTypeException |
||
| 40 | */ |
||
| 41 | protected function validateFileContent() |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @return FileLocation |
||
| 52 | */ |
||
| 53 | abstract protected function getFileLocation(); |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @param $rawInfo object created by finfo_file function |
||
| 57 | * @return string Error message for when the things going wrong with the mimeType of the file |
||
| 58 | */ |
||
| 59 | protected function getFileContentErrorMessage($rawInfo) |
||
| 63 | } |