protected function getExtension(string $path): ?string
    {
        $callback = function ($value) use ($path) {
            return $this->endsWith($path, $value);
        };

        foreach (\array_keys(self::$extensions) as $key => $value) {
            if ($callback($value)) {
                return $value;
            }
        }

        return null;
    }