src/PeekAndPoke/Component/Formal/Field/Atomic/AbstractChoice.php
private function init(array $options)
    {
        foreach ($options as $k => $v) {
            if ($v instanceof Option) {
                $this->options[$v->getFormValue()] = $v;
            } elseif (is_scalar($v)) {
                $this->options[$k] = new Option($k, $v, $k);
            }
        }

        if ($this->getMapper() === null) {
            $this->setMapper(new OptionMapper($this->options));
        }

        $acceptedValues = array_keys($this->options);

        if ($this->acceptEmpty) {
            $acceptedValues[] = null;
            $acceptedValues[] = '';
        }

        $this->that(
            Accepts::oneValueOutOf($acceptedValues, $this->message)
        );

        return $this;
    }
private function init(array $options)
    {
        foreach ($options as $k => $v) {
            if ($v instanceof Option) {
                $this->options[$v->getFormValue()] = $v;
            } elseif (is_scalar($v)) {
                $this->options[$k] = new Option($k, $v, $k);
            }
        }

        if ($this->getMapper() === null) {
            $this->setMapper(new OptionMapper($this->options));
        }

        $acceptedValues = array_keys($this->options);

        if ($this->acceptEmpty) {
            $acceptedValues[] = null;
            $acceptedValues[] = '';
        }

        $this->that(
            Accepts::oneValueOutOf($acceptedValues, $this->message)
        );

        return $this;
    }
@param string[]|Option[] $options

@return $this

@throws InvalidConfigurationValueException