protected function popString(&$str) {
        if ($str === '') {
            return null;
        }

        $pos = strrpos($str, '.');
        if ($pos !== false) {
            $result = substr($str, $pos + 1);
            $str = substr($str, 0, $pos);
        } else {
            $result = $str;
            $str = '';
        }
        return $result;
    }