private function assembleAddons($addons, $addonContainerClass)
    {
        if (0 === \count($addons))
        {
            return $this;
        }

        $div = Div::create()
                  ->addClass($addonContainerClass)
                  ->addChildren($addons,
                      function ($token) {
                          $content = $token['content'] ?? '';
                          $plainText = $token['plaintext'] ?? true;

                          // When not instructed to treat as plain text, use it directly
                          if (!$plainText)
                          {
                              return $content;
                          }

                          // When instructed to use as plain text, we wrap inside a span
                          $span = Span::create()->addClass('input-group-text');

                          return \is_string($content)
                              ? $span->text($content)
                              : $span->addChild($content);
                      });

        return $this->addChild($div);
    }