コード例 #1
0
ファイル: RequiredRule.php プロジェクト: jayacode/framework
 /**
  * @return bool
  */
 public function isValid()
 {
     if ($this->data === null || empty($this->data)) {
         $this->setErrorMessage($this->attributes["validatorName"], Lang::get("validator.required", ['name' => $this->attributes["name"]], "The {name} field is required."));
         return false;
     }
     return true;
 }
コード例 #2
0
ファイル: RegexRule.php プロジェクト: jayacode/framework
 /**
  * @return bool
  */
 public function isValid()
 {
     if ($this->data !== null && !preg_match("/" . $this->attributes['arg'] . "/", $this->data)) {
         $this->setErrorMessage($this->attributes["validatorName"], Lang::get("validator.regex", ['format' => $this->attributes['arg'], 'name' => $this->attributes["name"], 'value' => $this->data], "{name} ({value}) is not in the expected format {format}."));
         return false;
     }
     return true;
 }