From ea4b6c7699a7fbb7be3d9e5ce86c84a36b63f569 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 15 Mar 2015 19:13:25 +0100 Subject: Move get/set-Calls into ModelBase and abstract all access into a Model Conflicts: model/Overview.php model/Room.php model/StreamList.php tests/ModelTestbase.php --- model/StreamList.php | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'model/StreamList.php') diff --git a/model/StreamList.php b/model/StreamList.php index 531a787..d203a52 100644 --- a/model/StreamList.php +++ b/model/StreamList.php @@ -1,9 +1,35 @@ has('ROOMS.'.$slug)) + throw new NotFoundException('Room '.$slug); + + $this->slug = $slug; + $this->streams = array(); + + $streams = $this->get("ROOMS.$slug.STREAMS"); + foreach((array)$streams as $stream) { + $this->streams[$stream] = explode('-', $stream); + } + } + + public function getRoomSlug() { + return $this->slug; + } + + public function getRoom() { + return new Room($this->getRoomSlug()); + } + + public function getStreams() { + return array_keys($this->streams); + } + public function getIterator() { return new ArrayIterator($this->streams); } -- cgit v1.2.3