protected function instantiate( $interface, $class, array $args ) {
		try {
			if ( is_callable( $class ) ) {
				$class = call_user_func_array( $class, $args );
			}

			if ( is_string( $class ) ) {
				if ( null !== $this->injector ) {
					$class = $this->injector->make( $class, $args );
				} else {
					$class = $this->instantiateClass( $class, $args );
				}
			}
		} catch ( Exception $exception ) {
			throw FailedToInstantiateObject::fromFactory(
				$class,
				$interface,
				$exception
			);
		}

		if ( ! is_subclass_of( $class, $interface ) ) {
			throw FailedToInstantiateObject::fromInvalidObject(
				$class,
				$interface
			);
		}

		return $class;
	}