public function getMimeType()
    {
        if (!$this->mimeType) {
            $finfo = finfo_open(FILEINFO_MIME_TYPE, $this->magicFile);
            if (!$finfo) {
                throw new \UnexpectedValueException('Failed to open fileinfo database');
            }
            $this->mimeType = finfo_file($finfo, $this->file);
        }
        return $this->mimeType;
    }