public function buffer($key, $withLayout, $value = null) { $name = $this->getName(); // If no value is defined, assume it resides in the config if (is_null($value)) { $value = Helper::getConfigKey($name, $key); } if (is_null($value)) { throw new \InvalidArgumentException("Cannot buffer an empty value."); } // If a layout is present, add the value to it's buffer instead $name = $withLayout ? $this->getLayout() : $this->getName(); Helper::setBufferKey($name, $key, $value); }