objList = array(); $this->componentQueue = array(); $this->env = $env; } /** * @deprecated since 0.0.3 * @param $component * @param bool $preload * @return bool */ public function addComponent($component, $preload = false){ try { $obj = new VueJsComponent($component,$preload); $this->componentQueue[] = $component; $this->addComponentToArray($obj); } catch (Exception $e) { if($this->env == "dev") throw new Exception($e); else return false; } return true; } /** * @deprecated since 0.0.3 * @param VueJsComponent $obj */ protected function addComponentToArray(VueJsComponent $obj){ $this->objList[] = $obj; } /** * @deprecated since 0.0.3 * @return string */ public function build(){ $retrn = ''; foreach($this->objList as $item){ /** * @var VueJsComponent $item */ //check for dependencies if(is_array($item->getDependencies())){ foreach($item->getDependencies() as $require){ if(!in_array($require,$this->componentQueue)){ $this->componentQueue[] = $require; $obj = new VueJsComponent($require,true); $retrn .= $obj->getContent().PHP_EOL; } } } $retrn .= $item->getContent().PHP_EOL; } return $retrn; } }