Type controlling in lib/atomnoticefeed.php

This commit is contained in:
Mikael Nordfeldth 2015-07-09 13:56:02 +02:00
parent 43cec8eaac
commit 65f1f74f2b

View File

@ -113,10 +113,12 @@ class AtomNoticeFeed extends Atom10Feed
foreach ($notices as $notice) { foreach ($notices as $notice) {
$this->addEntryFromNotice($notice); $this->addEntryFromNotice($notice);
} }
} else { } elseif ($notices instanceof Notice) {
while ($notices->fetch()) { while ($notices->fetch()) {
$this->addEntryFromNotice($notices); $this->addEntryFromNotice($notices);
} }
} else {
throw new ServerException('addEntryFromNotices got neither an array nor a Notice object');
} }
} }
@ -125,7 +127,7 @@ class AtomNoticeFeed extends Atom10Feed
* *
* @param Notice $notice a Notice to add * @param Notice $notice a Notice to add
*/ */
function addEntryFromNotice($notice) function addEntryFromNotice(Notice $notice)
{ {
try { try {
$source = $this->showSource(); $source = $this->showSource();