public static function fromRepository($repository)
    {
        $message = sprintf(
            'Could not add invalid OptionRepository of type "%1$s" to AggregateOptionRepository.',
            is_object($repository)
                ? get_class($repository)
                : gettype($repository)
        );

        return new static($message);
    }