Example #1
0
 /**
  * Tests the name of the rule
  */
 public function testName()
 {
     $dir = new Connect();
     $this->assertEquals($dir->getName(), 'rcf_connect');
 }
Example #2
0
    /**
     * The error template
     * 
     * @var string
     */
    protected $error_message = 'Can\'t connect to {field}';
    /**
     * (non-PHPdoc)
     * 
     * @ignore
     *
     * @see \mithra62\Validate\RuleInterface::validate()
     */
    public function validate($field, $input, array $params = array())
    {
        try {
            if ($input == '' || empty($params['0'])) {
                return false;
            }
            $params = $params['0'];
            if (empty($params['rcf_username']) || empty($params['rcf_api'])) {
                return false;
            }
            return m62Rcf::getRemoteClient($params, false);
        } catch (\Exception $e) {
            return false;
        }
    }
}
$rule = new Connect();
\JaegerApp\Validate::addrule($rule->getName(), array($rule, 'validate'), $rule->getErrorMessage());