path = $path; $this->data = $data; $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); if (str_ends_with(normalize($trace[0]['file']), 'view/src/functions.php')) { $this->relativeRootPath = path($trace[1]['file'])->dirname()->toString(); } else { $this->relativeRootPath = path($trace[0]['file'])->dirname()->toString(); } } public function get(string $key): mixed { return $this->{$key} ?? $this->data[$key] ?? null; } public function has(string $key): bool { return array_key_exists($key, $this->data) || property_exists($this, $key); } public function data(mixed ...$params): self { $this->data = [...$this->data, ...$params]; return $this; } }