* * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file * */ namespace OCA\News; /** * This class models a folder that contains feeds. */ class Folder extends Collection { private $name; private $children; private $parent; private $opened; public function __construct($name, $id = null, Collection $parent = null) { $this->name = $name; if ($id !== null) { parent::__construct($id); } $this->children = array(); if ($parent !== null) { $this->parent = $parent; } if($this->opened === null){ $this->opened = true; } } public function getName() { return $this->name; } public function setName($name) { $this->name = $name; } public function getOpened() { return $this->opened; } public function setOpened($opened) { $this->opened = $opened; } public function setParentId() { if ($this->parent !== null) { } } public function getParentId() { if ($this->parent === null) { return 0; } return $this->parent->getId(); } public function addChild(Collection $child) { $this->children[] = $child; } public function addChildren($children) { $this->children = $children; } public function getChildren() { return $this->children; } public function jsonSerialize() { //TODO: this is just for test $encoding = array( 'id' => $this->getId(), 'parentId' => $this->getParentId(), 'title' => $this->getName(), ); return $encoding; } }