mimeType, 'image/'); } /** * Проверить, является ли вложение документом (DOC/DOCX) */ public function isDocument(): bool { $documentMimes = [ 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', ]; $documentExtensions = ['doc', 'docx']; return in_array($this->mimeType, $documentMimes, true) || in_array(strtolower(pathinfo($this->filename, PATHINFO_EXTENSION)), $documentExtensions, true); } /** * Получить расширение файла */ public function getExtension(): string { return strtolower(pathinfo($this->filename, PATHINFO_EXTENSION)); } }