/** * Get the Closure to be used when building a type. * Get the Closure to be used when building a type. * @param string $abstract * @param string $concrete * @return \Closure */ protected function getClosure($abstract, $concrete)// one is abstract other is concrete { return function ($c, $parameters = []) use ($abstract, $concrete) {// like get four parameters $method = ($abstract == $concrete) ? ‘build‘ : ‘make‘;// create the new type by class type. return $c->$method($concrete, $parameters);// return the instance of the class , }; }
时间: 2024-10-08 21:12:23