*/ class LSformRule_callable extends LSformRule { // CLI parameters autocompleters protected static $cli_params_autocompleters = array( 'callable' => null, ); /** * Check the value using the callable object * * @param mixed $value The value to check * @param array $options Validation option * - $options['params']['callable'] : the function use to check the value * * The callable object will be run to check the value. The given parameters are the * same of this method. * * @param object $formElement The LSformElement object * * @return boolean true if the value is valid, false otherwise */ public static function validate($value, $options, &$formElement) { $callable = LSconfig :: get('params.callable', null, null, $options); if (is_callable($callable)) return call_user_func_array( $callable, array( $value, LSconfig :: get('params', array(), null, $options), &$formElement ) ); LSerror :: addErrorCode('LSformRule_callable_01'); return False; } } /* * Error codes */ LSerror :: defineError('LSformRule_callable_01', ___("LSformRule_callable : The given callable option is not callable") );