protected static function parseAuthority(?string $authority): array
    {
        if ($authority === null) {
            return [
                'userInfo' => null,
                'host'     => null,
                'port'     => null
            ];
        }

        preg_match(static::AUTHORITY_PATTERN, $authority, $matches);

        $userInfo = isset($matches[1]) && $matches[1] ? $matches[1] : null;
        $host = isset($matches[2]) && $matches[2] ? $matches[2] : '';
        $port = isset($matches[3]) && $matches[3] ? ((int) $matches[3]) : null;

        return [
            'userInfo' => $userInfo,
            'host'     => $host,
            'port'     => $port
        ];
    }