public static function parametrize($str, $params) { $keys = array_keys($params); $vals = array_values($params); array_walk($keys, function (&$key) { $key = '%' . $key . '%'; }); return str_replace($keys, $vals, $str); }
/** * @param string $path * @return ClientInterface */ public function boot($path) { $core = (require realpath($path) . '/bootstrap/Console/Client/bootstrap.php'); $controller = (new ReflectionClass(StringSupport::parametrize($this->controllerClass, $this->params)))->newInstanceArgs(array_merge($this->controllerParams)); $controller->setCore($core); $core->config($controller->internalConfig($core)); $controller->internalBoot($core); $core->boot(); $controller->internalConstruct($core); return $controller; }