public function init() { if (isset($this->_value)) { return $this; } else { if ($this->_source instanceof File) { $this->_value = \Coast\load($this->_source, $this->_vars); } else { if ($this->_source instanceof Closure) { $this->_value = call_user_func($this->_source, $this->_vars); } } } if ($this->_value instanceof App) { $this->_value->isSubapp($this->isSubapp()); } return $this; }
/** * Load a file without leaking variables, include app object in vars. * @param mixed $file * @param array $vars * @return mixed */ public function load($file, array $vars = array()) { $file = !$file instanceof File ? new File("{$file}") : $file; $file = $file->isRelative() ? $this->file($file) : $file; return \Coast\load($file, array_merge(['app' => $this], $vars)); }