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;
    }
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;
    }
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 ; }
Add a command to the response

@param int|string|array $cmd Integer for command, see Phery.js for more info
@param array $args Array to pass to the response
@param string $selector Insert the jquery selector

@return PheryResponse
Add a command to the response