protected function validateAbstractFactoryEntry($entry)
    {
        if (!is_string($entry) && !$entry instanceof AbstractFactoryInterface) {
            $type = is_object($entry) ? get_class($entry) : gettype($entry);
            $message = sprintf('Argument "entry" in "%s" must be a string or an instance '
                    . 'of "%s"; "%s" was given.', __METHOD__, AbstractFactoryInterface::class, $type);
            throw new Exception\InvalidArgumentException($message);
        }

        if (is_string($entry)) {
            if (!class_exists($entry)) {
                throw new Exception\ClassNotFoundException($entry);
            }

            if (!is_subclass_of($entry, AbstractFactoryInterface::class)) {
                $message = sprintf('Entry "%s" in "%s" is expected to be an instance of "%s".', $entry, __METHOD__, AbstractFactoryInterface::class);
                throw new Exception\InvalidArgumentException($message);
            }
        }
    }