/** * Validate the data is correct * * @param string[] $data * @throws InvalidFieldException */ protected function validate($data) { foreach ($data as $code => $item) { if (!Column::isValidColumn($code)) { throw new InvalidFieldException("The data provided [{$code}] was not a valid field code."); } } }
public function testIsValidColumn() { $this->assertTrue(Column::isValidColumn("At")); $this->assertFalse(Column::isValidColumn("Invalid")); }