public function setForResource($resource, $classOrCallableOrInstance)
    {

        // short this awful long name...
        $factory = $classOrCallableOrInstance;

        $resourceName = $this->resourceName($resource);

        if ($factory instanceof ValidatorContract) {
            $this->resourceFactories[$resourceName] = function () use ($factory) {
                return clone $factory; // Always return a fresh instance
            };
            return $this;
        }

        if (is_callable($factory)) {
            $this->resourceFactories[$resourceName] = $factory;
            return $this;
        }

        if (is_string($factory)) {
            $this->resourceFactories[$resourceName] = function () use ($factory) {
                return $this->createObject($factory);
            };
            return $this;
        }

        throw new InvalidArgumentException('You can pass a classname, callable or Validator');
    }