public function fields(array $fields)
    {
        $newFields = array();
        $this->fields = '';
        $this->fieldsArguments = array();

        foreach ($fields as $field) {
            if (is_scalar($field)) {
                $newFields[] = '?f:alias:.?f';
                $this->fieldsArguments[] = $field;
            } else {
                if (!isset($field[0]) or !isset($field[1]) or !is_array($field[1])) {
                    throw new \BadMethodCallException('Must be exist 0 and 1 index in array and second one must be an array');
                }
                $newFields[] = $field[0];
                $this->fieldsArguments = array_merge($this->fieldsArguments, $field[1]);
            }
        }

        $this->fields = implode(', ', $newFields);

        return $this;
    }
public function fields(array $fields)
    {
        $newFields = array();
        $this->fields = '';
        $this->fieldsArguments = array();

        foreach ($fields as $field) {
            if (is_scalar($field)) {
                $newFields[] = '?f:alias:.?f';
                $this->fieldsArguments[] = $field;
            } else {
                if (!isset($field[0]) or !isset($field[1]) or !is_array($field[1])) {
                    throw new \BadMethodCallException('Must be exist 0 and 1 index in array and second one must be an array');
                }
                $newFields[] = $field[0];
                $this->fieldsArguments = array_merge($this->fieldsArguments, $field[1]);
            }
        }

        $this->fields = implode(', ', $newFields);

        return $this;
    }
public function fields ( array $ fields ) { $ newFields = array ( ) ; $ this -> fields = '' ; $ this -> fieldsArguments = array ( ) ; foreach ( $ fields as $ field ) { if ( is_scalar ( $ field ) ) { $ newFields [ ] = '?f:alias:.?f' ; $ this -> fieldsArguments [ ] = $ field ; } else { if ( ! isset ( $ field [ 0 ] ) or ! isset ( $ field [ 1 ] ) or ! is_array ( $ field [ 1 ] ) ) { throw new \ BadMethodCallException ( 'Must be exist 0 and 1 index in array and second one must be an array' ) ; } $ newFields [ ] = $ field [ 0 ] ; $ this -> fieldsArguments = array_merge ( $ this -> fieldsArguments , $ field [ 1 ] ) ; } } $ this -> fields = implode ( ', ' , $ newFields ) ; return $ this ; }
Sets fields statement

@param $fields array('id', array('AsText(?f) AS ?f', array('coords', 'coords')))
@throws \BadMethodCallException
@return $this
Sets fields statement