Google\Spreadsheet\Worksheet::getListFeed PHP Method

getListFeed() public method

Get the list feed of this worksheet
public getListFeed ( array $query = [] ) : ListFeed
$query array add additional query params to the url to sort/filter the results
return ListFeed
    public function getListFeed(array $query = [])
    {
        $feedUrl = $this->getListFeedUrl();
        if (count($query) > 0) {
            $feedUrl .= "?" . http_build_query($query);
        }
        $res = ServiceRequestFactory::getInstance()->get($feedUrl);
        return new ListFeed(new \SimpleXMLElement($res));
    }

Usage Example

 public function testGetListFeedWithQuery()
 {
     $feedUrl = "https://spreadsheets.google.com/feeds/list/tA3TdJ0RIVEem3xQZhG2Ceg/od8/private/full?reverse=true&sq=age+%3E+45";
     $mockServiceRequest = $this->getMockBuilder('Google\\Spreadsheet\\DefaultServiceRequest')->setMethods(array("get"))->disableOriginalConstructor()->getMock();
     $mockServiceRequest->expects($this->once())->method('get')->with($this->equalTo($feedUrl))->willReturn(file_get_contents(__DIR__ . '/xml/list-feed.xml'));
     ServiceRequestFactory::setInstance($mockServiceRequest);
     $worksheet = new Worksheet(new SimpleXMLElement(file_get_contents(__DIR__ . '/xml/worksheet.xml')));
     $worksheet->getListFeed(array("reverse" => "true", "sq" => "age > 45"));
 }
All Usage Examples Of Google\Spreadsheet\Worksheet::getListFeed