protected function readColumnHeaders(QuiteSimpleXMLElement $results)
    {
        $headers = array_map(function (QuiteSimpleXMLElement $node) {
            return $node->attr('saw-sql:columnHeading');
        }, $results->all('//xsd:complexType[@name="Row"]/xsd:sequence/xsd:element[position()>1]'));

        if (!count($headers)) {
            // No column headers included in this response. They're only
            // included in the first response, so that's probably fine.
            return;
        }

        if (!count($this->headers)) {
            $this->headers = $headers;

            return;
        }

        if (count($headers) != count($this->headers)) {
            throw new \RuntimeException(sprintf(
                'The number of returned columns (%d) does not match the number of assigned headers (%d).',
                count($headers),
                count($this->headers)
            ));
        }
    }
protected function readColumnHeaders(QuiteSimpleXMLElement $results)
    {
        $headers = array_map(function (QuiteSimpleXMLElement $node) {
            return $node->attr('saw-sql:columnHeading');
        }, $results->all('//xsd:complexType[@name="Row"]/xsd:sequence/xsd:element[position()>1]'));

        if (!count($headers)) {
            // No column headers included in this response. They're only
            // included in the first response, so that's probably fine.
            return;
        }

        if (!count($this->headers)) {
            $this->headers = $headers;

            return;
        }

        if (count($headers) != count($this->headers)) {
            throw new \RuntimeException(sprintf(
                'The number of returned columns (%d) does not match the number of assigned headers (%d).',
                count($headers),
                count($this->headers)
            ));
        }
    }
protected function readColumnHeaders ( QuiteSimpleXMLElement $ results ) { $ headers = array_map ( function ( QuiteSimpleXMLElement $ node ) { return $ node -> attr ( 'saw-sql:columnHeading' ) ; } , $ results -> all ( '//xsd:complexType[@name="Row"]/xsd:sequence/xsd:element[position()>1]' ) ) ; if ( ! count ( $ headers ) ) { // No column headers included in this response. They're only // included in the first response, so that's probably fine. return ; } if ( ! count ( $ this -> headers ) ) { $ this -> headers = $ headers ; return ; } if ( count ( $ headers ) != count ( $ this -> headers ) ) { throw new \ RuntimeException ( sprintf ( 'The number of returned columns (%d) does not match the number of assigned headers (%d).' , count ( $ headers ) , count ( $ this -> headers ) ) ) ; } }
Read column headers from response, and check that we got the right number of columns back.

@param QuiteSimpleXMLElement $results
Read column headers from response and check that we got the right number of columns back .