public function __construct(ParsedInput $valid) { if (!$valid->isValidated()) { throw new BadMethodCallException(); } $this->setData($valid->getData()); }
/** * @param array data to add * @return this * @throws BadMethodCallException */ public function addData(ParsedInput $add) : self { if ($this->isValidated()) { throw new BadMethodCallException("Data cannot be added after validation is performed"); } if ($add->isValidated()) { throw new BadMethodCallException("Data cannot be added after validation is performed"); } $this->setData(array_merge($add->getData(), $this->getData())); return $this; }