私は次のものを持っていますが、$ type変数を2番目のcheckUkPhone関数に渡す方法、またはそれを参照する方法を理解できません。何か案は?
public function isValidUkPhone($fieldName, $type) {
//Set the filter options
$this -> _filterArgs[$fieldName] = array('filter' => FILTER_CALLBACK, 'options' => array($this, 'checkUkPhone'));
}
public function checkUkPhone($type) {
$this -> _errors[$fieldName] = $FieldName.':Phone must begin with 07';
}
// Apply the validation tests using filter_input_array()
$this->_filtered = filter_var_array($data, $this->_filterArgs);
foreach ($this->_filtered as $key => $value) {
// Skip items that used the isBool() method or that are either missing or not required
if (in_array($key, $this->_booleans) || in_array($key, $this->_missing) || !in_array($key, $this->_required)) {
if (in_array($key, $this->_missing)){
$this->_errors[$key] = $key . ':Required';
}
continue;
} elseif ($value === false) {
// If the filtered value is a boolean false, it failed validation,
// so add it to the $errors array
$this->_errors[$key] = $key . ':Invalid data supplied';
}
}
// Return the validated input as an array
return $this->_filtered;