Elgg\Filesystem\MimeTypeDetector::getType PHP Метод

getType() публичный Метод

Sniff the MIME type
public getType ( string $file, string $default = self::DEFAULT_TYPE ) : string
$file string File path
$default string Default type to return on failure
Результат string MIME type
    public function getType($file, $default = self::DEFAULT_TYPE)
    {
        // Check only existing files
        if (!is_file($file) || !is_readable($file)) {
            return $default;
        }
        $ext = pathinfo($file, PATHINFO_EXTENSION);
        $type = $this->tryStrategies($file);
        if ($type) {
            return $this->fixDetectionErrors($type, $ext);
        }
        if ($this->use_extension && isset($this->extensions[$ext])) {
            return $this->extensions[$ext];
        }
        return $default;
    }