component = $component; $this->preload = $preload; $this->load(); } /** * @deprecated since 0.0.3 * @param $overridePath */ protected function load($overridePath = null){ if(is_null($overridePath)) $path = $_SERVER['DOCUMENT_ROOT'].'/src/components/'; else{ $path = realpath($overridePath); if(substr($path, -1) != "/") $path .= '/'; } $this->path = $path.$this->component.'.vue'; if(!is_file($this->path)) throw new Exception('Component '.$this->component.' not found in '.$path); if($this->preload) $this->loadContent(); } /** * @deprecated since 0.0.3 * load file content */ protected function loadContent(){ $this->content = file_get_contents($this->path); } /** * @deprecated since 0.0.3 * @return string */ public function getContent(): string { if(empty($this->content)) $this->loadContent(); return $this->content; } /** * @deprecated since 0.0.3 * @return array|bool */ public function getDependencies(){ if(empty($this->content)) $this->loadContent(); preg_match_all("//", $this->content, $output_array); if(!isset($output_array[1])) return false; $ret = array(); foreach($output_array[1] as $require){ $ret[] = $require; } return $ret; } }