classes/Container.php
public function invoke($callable, array $params = array())
	{
		// if $callable is a string, assume it's a class name with the method
		// "invoke" defined
		if (is_string($callable) && !is_callable($callable)) {
			$callable = [$callable, 'invoke'];
		}

		// if $callable is a static method-like string, convert it to an array
		if (is_string($callable) && strpos($callable, '::') !== false) {
			$callable = explode('::', $callable);
		}

		$class = null;
		$object = null;

		if (is_array($callable)) {
			$class = $callable[0];
			$method = $callable[1];

			if (is_object($class)) {
				$object = $class;
				$class = get_class($object);
			} else {
				$object = $this->resolve($class);
			}

			$reflFunc = new ReflectionMethod($object, $method);

			if ($reflFunc->isStatic()) {
				$object = null;
			}

			$callableString = $class.'::'.$method;
			if (isset($this->params[$callableString])) {
				$params = array_replace($this->params[$callableString], $params);
			}
		} else if (is_callable($callable)) {
			$reflFunc = new ReflectionFunction($callable);
		} else {
			$type = is_object($callable) ? get_class($callable) : gettype($callable);
			throw new \InvalidArgumentException("Callable must be a callable or array, $type given");
		}

		$args = $this->getFunctionArguments($reflFunc, $params);

		if ($class) {
			return $reflFunc->invokeArgs($object, $args);
		}

		return $reflFunc->invokeArgs($args);
	}
public function invoke($callable, array $params = array())
	{
		// if $callable is a string, assume it's a class name with the method
		// "invoke" defined
		if (is_string($callable) && !is_callable($callable)) {
			$callable = [$callable, 'invoke'];
		}

		// if $callable is a static method-like string, convert it to an array
		if (is_string($callable) && strpos($callable, '::') !== false) {
			$callable = explode('::', $callable);
		}

		$class = null;
		$object = null;

		if (is_array($callable)) {
			$class = $callable[0];
			$method = $callable[1];

			if (is_object($class)) {
				$object = $class;
				$class = get_class($object);
			} else {
				$object = $this->resolve($class);
			}

			$reflFunc = new ReflectionMethod($object, $method);

			if ($reflFunc->isStatic()) {
				$object = null;
			}

			$callableString = $class.'::'.$method;
			if (isset($this->params[$callableString])) {
				$params = array_replace($this->params[$callableString], $params);
			}
		} else if (is_callable($callable)) {
			$reflFunc = new ReflectionFunction($callable);
		} else {
			$type = is_object($callable) ? get_class($callable) : gettype($callable);
			throw new \InvalidArgumentException("Callable must be a callable or array, $type given");
		}

		$args = $this->getFunctionArguments($reflFunc, $params);

		if ($class) {
			return $reflFunc->invokeArgs($object, $args);
		}

		return $reflFunc->invokeArgs($args);
	}
{@inheritdoc}