public function mode($mode) { if (!isset($this->templates[$mode])) { throw new Exception(['Structure builder does not have this mode', 'mode' => $mode]); } $this->mode = $mode; $this->template = $this->templates[$mode]; return $this; }