From b4271a3533bdf12329f27dd75452c1ef2a6ee3d1 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 2 Mar 2016 11:40:43 +0100 Subject: [PATCH] Stricted typing + protected on FilteringNoticeStream->filter --- lib/filteringnoticestream.php | 4 ++-- lib/scopingnoticestream.php | 2 +- lib/threadingnoticestream.php | 8 ++------ plugins/Event/lib/eventsnoticestream.php | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/filteringnoticestream.php b/lib/filteringnoticestream.php index b4ec6687bb..979305ad39 100644 --- a/lib/filteringnoticestream.php +++ b/lib/filteringnoticestream.php @@ -49,12 +49,12 @@ abstract class FilteringNoticeStream extends NoticeStream { protected $upstream; - function __construct($upstream) + function __construct(NoticeStream $upstream) { $this->upstream = $upstream; } - abstract function filter($notice); + abstract protected function filter(Notice $notice); function getNoticeIds($offset, $limit, $since_id, $max_id) { diff --git a/lib/scopingnoticestream.php b/lib/scopingnoticestream.php index 84af75948d..854903d33d 100644 --- a/lib/scopingnoticestream.php +++ b/lib/scopingnoticestream.php @@ -61,7 +61,7 @@ class ScopingNoticeStream extends FilteringNoticeStream * @return boolean whether to include the notice */ - function filter($notice) + protected function filter(Notice $notice) { return $notice->inScope($this->scoped); } diff --git a/lib/threadingnoticestream.php b/lib/threadingnoticestream.php index 167a9584a6..de113b2a41 100644 --- a/lib/threadingnoticestream.php +++ b/lib/threadingnoticestream.php @@ -28,11 +28,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET')) { - // This check helps protect against security problems; - // your code file can't be executed directly from the web. - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } /** * This notice stream filters notices by whether their conversation @@ -58,7 +54,7 @@ class ThreadingNoticeStream extends FilteringNoticeStream return parent::getNotices($offset, $limit, $sinceId, $maxId); } - function filter($notice) + protected function filter(Notice $notice) { if (!array_key_exists($notice->conversation, $this->seen)) { $this->seen[$notice->conversation] = true; diff --git a/plugins/Event/lib/eventsnoticestream.php b/plugins/Event/lib/eventsnoticestream.php index 3dd1a81bd1..b9e40430e7 100644 --- a/plugins/Event/lib/eventsnoticestream.php +++ b/plugins/Event/lib/eventsnoticestream.php @@ -64,7 +64,7 @@ class EventsNoticeStream extends ScopingNoticeStream parent::__construct(new CachingNoticeStream($stream, $key), $scoped); } - function filter($notice) + protected function filter(Notice $notice) { if (!parent::filter($notice)) { // if not in our scope, return false