public function cmd($cmd, array $args = array(), $selector = null)
    {
        if (!$this->matched) {
            $this->matched = true;
            return $this;
        }

        $selector = Phery::coalesce($selector, $this->last_selector);

        if ($selector === null) {
            $this->data['0' . ($this->internal_cmd_count++)] = array(
                'c' => $cmd,
                'a' => $args
            );
        } else {
            if (!isset($this->data[$selector])) {
                $this->data[$selector] = array();
            }
            $this->data[$selector][] = array(
                'c' => $cmd,
                'a' => $args
            );
        }

        if ($this->restore !== null) {
            $this->last_selector = $this->restore;
            $this->restore = null;
        }

        return $this;
    }