/** * @param ClassDefinition $definition * @param array $args * * @return mixed * @throws TypeMismatchException */ public function getClass(ClassDefinition $definition, array $args = []) { $abstract = $definition->getValue(); $class = $definition->getId(); if (is_callable($abstract)) { $instance = $this->container->call($abstract, $args); } else { if (is_object($abstract)) { $instance = $abstract; } else { if ($abstract === null) { $abstract = $class; } $instance = $this->reflector->resolveClass($this->container, $abstract, $args); } } $this->matchClassType($class, $instance); return $instance; }
/** * @param $class * @param $method * @param array $args * * @return mixed */ public function callStaticMethod($class, $method, array $args = []) { return $this->rethrowExceptions(function () use($class, $method, $args) { return $this->reflector->resolveMethod($this, $class, $method, $args); }); }