sections[$section->getName()] = $section; } /** * @param string $name * * @return bool */ public function hasSection($name) { return isset($this->sections[$name]); } /** * @param string $name * * @return Section */ public function getSection($name) { return $this->sections[$name]; } /** * @param string $name * @param Section $section * * @return Section */ public function setSection($name, Section $section) { return $this->sections[$name] = $section; } /** * @param string $name */ public function removeSection($name) { unset ($this->sections[$name]); } /** * @return string */ public function render() { foreach ($this->sections as $section) { $sections []= $section->render(); } $str = implode(PHP_EOL, $sections); if (! empty($this->commentsDangling)) { foreach ($this->commentsDangling as $comment) { $str .= PHP_EOL . $comment->render(); } } return $str; } }