public getByTitle ( string $title ) : |
||
$title | string | |
return |
public function getByTitle($title)
{
foreach ($this->xml->entry as $entry) {
if ($entry->title->__toString() == $title) {
return new Spreadsheet($entry);
}
}
throw new SpreadsheetNotFoundException();
}
public function testGetByTitle() { $xml = file_get_contents(__DIR__ . '/xml/spreadsheet-feed.xml'); $spreadsheetFeed = new SpreadsheetFeed($xml); $this->assertTrue($spreadsheetFeed->getByTitle('Test Spreadsheet') instanceof Spreadsheet); $this->assertTrue(is_null($spreadsheetFeed->getByTitle('No Spreadsheet'))); }