public function save(string $id, $object, $map): void
    {
        if (\is_callable($map)) {
            $map = $map();
        }

        if (!is_iterable($map)) {
            throw new \InvalidArgumentException('Map must be iterable or a callback, returning an iterable value.');
        }

        $data = [];

        foreach ($map as $source => $target) {
            $exception = $this->accessor->getValue($object, $source);

            if (null === $exception) {
                continue;
            }

            if (!$exception instanceof RunetIdException) {
                throw new \UnexpectedValueException(sprintf('Expected null or an instance of "%s".', RunetIdException::class));
            }

            $data[] = [$target, $exception->getMessage()];
        }

        $id = self::PREFIX.$id;
        $this->session->set($id, $data);
    }
public function save(string $id, $object, $map): void
    {
        if (\is_callable($map)) {
            $map = $map();
        }

        if (!is_iterable($map)) {
            throw new \InvalidArgumentException('Map must be iterable or a callback, returning an iterable value.');
        }

        $data = [];

        foreach ($map as $source => $target) {
            $exception = $this->accessor->getValue($object, $source);

            if (null === $exception) {
                continue;
            }

            if (!$exception instanceof RunetIdException) {
                throw new \UnexpectedValueException(sprintf('Expected null or an instance of "%s".', RunetIdException::class));
            }

            $data[] = [$target, $exception->getMessage()];
        }

        $id = self::PREFIX.$id;
        $this->session->set($id, $data);
    }
{@inheritdoc}