* @author Eric VILLARD <*****@*****.**> * @copyright (c) 2013 Eric VILLARD <*****@*****.**> * @license http://opensource.org/licenses/MIT MIT License */ namespace evidev\tests\boostrap; final class Bootstrapper { private $nspaths; private function __construct() { } public static function create() { return new static(); } public function prepareNsPaths($nspaths = array()) { $this->nspaths = $nspaths; return $this; } public function run() { $loader = (require __DIR__ . '/../vendor/autoload.php'); foreach ($this->nspaths as $ns => $paths) { $loader->add($ns, $paths); } } } Bootstrapper::create()->prepareNsPaths(array('evidev' => array(__DIR__)))->run();
private function __construct() { } public static function create() { return new static(); } public function prepareNsPaths($nspaths = array()) { $this->nspaths = $nspaths; return $this; } public function loadFiles($files = array()) { foreach ($files as $file) { if (file_exists($file)) { require_once $file; } } return $this; } public function run() { $loader = (require __DIR__ . '/../vendor/autoload.php'); foreach ($this->nspaths as $ns => $paths) { $loader->add($ns, $paths); } } } Bootstrapper::create()->prepareNsPaths(array('evidev' => array(__DIR__)))->loadFiles(array(__DIR__ . '/../vendor/antecedent/patchwork/Patchwork.php'))->run();