/** * Extends the set method to ensure that only Radios can be added to a RadioGroup * * @param string $key * @param mixed $value * * @return $this * * @throws \InvalidArgumentException * * @since 2.0 */ public function set($key, $value) { if (!$value instanceof Radio) { throw new \InvalidArgumentException('Only Radios can be added to a RadioGroup'); } return parent::set($key, $value); }
/** * Extends the set method to ensure that only Checkboxs can be added to a CheckboxGroup * * @param string $key * @param mixed $value * * @return $this * * @throws \InvalidArgumentException * * @since 2.0 */ public function set($key, $value) { if (!$value instanceof Checkbox) { throw new \InvalidArgumentException('Only Checkboxs can be added to a CheckboxGroup'); } return parent::set($key, $value); }