function run($thing) { $this->errors = array(); $verdict = true; foreach ($this->field_names as $field_name) { // do not try to validate missing fields if (!gp_object_has_var($thing, $field_name)) { continue; } $value = $thing->{$field_name}; $field_verdict = $this->run_on_single_field($field_name, $value); $verdict = $verdict && $field_verdict; } return $verdict; }
function test_gp_object_has_var_returs_true_if_var_is_null() { $this->assertTrue(gp_object_has_var((object) array('baba' => null), 'baba')); }