/** * Get file extension * * @return string */ public function getExtension() { if ($this->extension === null) { $hit = Mimetypes::getExtensionForMimetype($this->getMimetype()); $this->extension = $hit ? $hit : parent::getExtension(); } return $this->extension; }
/** * Return the mimetype of the file. * * @return string */ public function getMimetype() { return Mimetypes::getInstance()->fromFilename($this->path) ?: 'text/plain'; }