Esempio n. 1
0
 /**
  * Resolves the stored object construction routine with the provided
  * arguments and setter methods.
  *
  * @param array  $args      An associative array of user defined arguments that is used during instantiation.
  *                          User defined arguments take precedence over configurations.
  *                          and the array value the method arguments.
  *
  * @return mixed
  *
  * @throws ResolutionException
  */
 public function resolve(array $args)
 {
     $callback = $this->callback;
     $resolved = [];
     if ($this->dependencies) {
         $resolved = $this->dependencies->resolve($args);
     }
     return $callback(...$resolved);
 }
Esempio n. 2
0
 /**
  * Resolves the stored object construction routine with the provided
  * arguments and setter methods.
  *
  * @param array  $args      An associative array of user defined arguments that is used during instantiation.
  *                          User defined arguments take precedence over configurations.
  *                          and the array value the method arguments.
  *
  * @return object
  *
  * @throws ResolutionException
  */
 public function resolve(array $args)
 {
     $class = $this->class;
     if ($this->dependencies) {
         $dependencies = $this->dependencies->resolve($args);
         $instance = new $class(...$dependencies);
     } else {
         $instance = new $class();
     }
     return $instance;
 }