Path to project root * @pPackages Packages to load * */ public function __construct($pRoot, $pPackages){ /* [1] Stores the path =========================================================*/ $this->root = $pRoot; /* [2] Stores the packages =========================================================*/ $this->packages = $pPackages; } public function build(){ /* [1] Builds project's base file structure =========================================================*/ /* (1) Copy from src/files */ shell_exec("cp -r ".__ROOT__."/src/files/* ".$this->root); /* [2] Browse each package to load =========================================================*/ foreach($this->packages as $package=>$version){ $path = "/$package/$version"; /* (1) Copy package folder if it exists */ if( file_exists(__ROOT__."/src/packages$path/") && is_dir(__ROOT__."/src/packages$path/") && count(scandir(__ROOT__."/src/packages$path/")) > 2 ) shell_exec("cp -r ".__ROOT__."/src/packages$path ".$this->root."/build/$package"); /* (2) Copy package config if it exists */ if( file_exists(__ROOT__."/src/config$path/") && is_dir(__ROOT__."/src/config$path/") && count(scandir(__ROOT__."/src/config$path/")) > 2 ) shell_exec("cp -r ".__ROOT__."/src/config$path/* ".$this->root."/config/"); } } }