Elgg  Version 3.0
ValidationResult.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Validation;
4 
9 
13  protected $name;
14 
18  protected $value;
19 
23  protected $message;
24 
28  protected $error;
29 
36  public function __construct($name, $value) {
37  $this->name = $name;
38  $this->value = $value;
39  }
40 
48  public function pass($message = '') {
49  $this->message = $message;
50  }
51 
59  public function fail($error = '') {
60  $this->error = $error;
61  }
62 
68  public function isValid() {
69  return !isset($this->error);
70  }
71 
77  public function getName() {
78  return $this->name;
79  }
80 
86  public function getValue() {
87  return $this->value;
88  }
89 
95  public function getError() {
96  return $this->error;
97  }
98 
104  public function getMessage() {
105  return $this->message;
106  }
107 }
pass($message= '')
Set parameter value as passing validation.
$data value
Definition: default.php:27
__construct($name, $value)
Constructor.
getValue()
Get parameter valud.
$result error
fail($error= '')
Set parameter value as failing validation.
$result message
getMessage()
Get success message.
$site name
Represents a parameter that has been validated.
isValid()
Is parameter value valid?