Skip to content

Instantly share code, notes, and snippets.

@johncongdon
Created July 16, 2014 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johncongdon/171bfe6d0414282fba4a to your computer and use it in GitHub Desktop.
Save johncongdon/171bfe6d0414282fba4a to your computer and use it in GitHub Desktop.
protected function validateEventData($data)
{
$days = (int)$data['pipeline_event_days'];
if ($data['pipeline_event_days'] != $days)
{
throw new Exception('Invalid value for days');
}
throw new Exception("....if ({$data['pipeline_event_days']} != $days)....");
}
try{
validateEventData(array('pipeline_event_days' => 'abc'));
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment