/** * Adds a subfolder to this folder. * @param Folder $child The folder to add as subfolder. * @throws FolderException Thrown if this folder is not the parent of the child folder (DNA-tested). * @author Björn Hjortsten * @return void */ protected function addChild(Folder $child) { if ($child->getParentId() == $this->getId()) { $this->children[$child->getId()] = $child; } else { throw new FolderException(sprintf('The supplied folder is not a child of this folder. This folders id: %d, childs id: %d, childs parent id: %d', $this->getId(), $child->getId(), $child->getParentId())); } }