protected function queryToMeta($query)
    {
        $query = str_replace(' ', '+', $query);

        if (preg_match('~^(?:hashtag:|#)(\w+)$~i', $query, $matches)) {

            $type = 'hashtag';
            $url  = 'https://twitter.com/hashtag/' . $matches[1] . '?f=tweets';

        } elseif (preg_match('~^(?:user:|@)(\w+)$~i', $query, $matches)) {

            $type = 'user';
            $url  = 'https://twitter.com/' . $matches[1];

        } elseif (preg_match('~^(?:search:)(.+)$~i', $query, $matches)) {

            $type = 'search';
            $url  = 'https://twitter.com/search?f=tweets&q=' . $matches[1];

        } else {

            $type = 'search';
            $url  = 'https://twitter.com/search?f=tweets&q=' . $query;
        }

        return [ 'query' => $query, 'type' => $type, 'url' => $url ];
    }