protected function checkBuilderState($internal = false) { if ($this->frozen === true && $this->internal === false) { throw new \BadMethodCallException('Cannot create new nodes, when internal state is frozen.'); } $this->internal = $internal; }