You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownew \Exception("Not found this validate method:".$rule, 1);
}
} catch (\Exception$ex) {
thrownew \Exception("Not found this validate method:".$rule, 1);
}
returnfalse;
}
protectedfunctiongetEmail($ruleKey, $inputAry)
{
if (!isset($inputAry[$ruleKey]))
{
returntrue;
}
if (!filter_var($inputAry[$ruleKey], FILTER_VALIDATE_EMAIL))
{
$this->error[$ruleKey] = isset( $this->message[$ruleKey]) ? str_replace(['%ruleKey%', '%value%'], [$ruleKey, $inputAry[$ruleKey]],$this->message[$ruleKey]) : ' this '.$ruleKey .' is not a validate email , value:'.$inputAry[$ruleKey];
}
}
protectedfunctiongetInt($ruleKey, $inputAry)
{
if (!isset($inputAry[$ruleKey]) || trim($inputAry[$ruleKey]) =='')
{
returntrue;
}
if (!is_numeric($inputAry[$ruleKey]))
{
$this->error[$ruleKey] = isset( $this->message[$ruleKey]) ? str_replace(['%ruleKey%', '%value%'], [$ruleKey, $inputAry[$ruleKey]],$this->message[$ruleKey]) : ' this '.$ruleKey .' is not a validate int , value:'.$inputAry[$ruleKey];
}
}
protectedfunctiongetRequired($ruleKey, $inputAry)
{
if (!isset($inputAry[$ruleKey]) || trim($inputAry[$ruleKey]) =='')
{
$this->error[$ruleKey] = isset( $this->message[$ruleKey]) ? str_replace(['%ruleKey%', '%value%'], [$ruleKey, $inputAry[$ruleKey]],$this->message[$ruleKey]) : ' this '.$ruleKey .' is required';
}
}
protectedfunctiongetArray($ruleKey, $inputAry)
{
if (!isset($inputAry[$ruleKey]))
{
returntrue;
}
if (!is_array($inputAry[$ruleKey])) {
$this->error[$ruleKey] = isset( $this->message[$ruleKey]) ? str_replace(['%ruleKey%', '%value%'], [$ruleKey, $inputAry[$ruleKey]],$this->message[$ruleKey]) : ' this '.$ruleKey .' is not a validate array , value:'.$inputAry[$ruleKey];
}
}
protectedfunctiongetString($ruleKey, $inputAry)
{
if (!isset($inputAry[$ruleKey]))
{
returntrue;
}
if (!is_string($inputAry[$ruleKey])) {
$this->error[$ruleKey] = isset( $this->message[$ruleKey]) ? str_replace(['%ruleKey%', '%value%'], [$ruleKey, $inputAry[$ruleKey]],$this->message[$ruleKey]) : ' this '.$ruleKey .' is not a validate string , value:'.$inputAry[$ruleKey];
if (!isset($inputAry[$ruleKey]) || (trim($inputAry[$ruleKey]) == ''))
{
returntrue;
}
if (isset($formatAry['format'])) {
$format = $formatAry['format'];
} else {
$format = 'Y-m-d H:i:s';
}
if (!$this->validateDate($inputAry[$ruleKey], $format))
{
$this->error[$ruleKey] = isset( $this->message[$ruleKey]) ? str_replace(['%ruleKey%', '%value%'], [$ruleKey, $inputAry[$ruleKey]],$this->message[$ruleKey]) : ' this '.$ruleKey .' is not a validate date , value:'.$inputAry[$ruleKey];
}
}
protectedfunctiongetJson($ruleKey, $inputAry)
{
if (!isset($inputAry[$ruleKey]) || trim($inputAry[$ruleKey]) =='')
{
returntrue;
}
json_decode($inputAry[$ruleKey]);
if (json_last_error())
{
$this->error[$ruleKey] = isset( $this->message[$ruleKey]) ? str_replace(['%ruleKey%', '%value%'], [$ruleKey, $inputAry[$ruleKey]],$this->message[$ruleKey]) : ' this '.$ruleKey .' is not a validate json , value:'.$inputAry[$ruleKey];