Elgg  Version 6.0
ValidationResult.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Validation;
4 
9 
10  protected string $message = '';
11 
12  protected string $error = '';
13 
20  public function __construct(protected string $name, protected $value) {
21  }
22 
30  public function pass(string $message = ''): void {
31  $this->message = $message;
32  }
33 
41  public function fail(string $error = ''): void {
42  $this->error = $error;
43  }
44 
50  public function isValid(): bool {
51  return $this->error === '';
52  }
53 
59  public function getName(): string {
60  return $this->name;
61  }
62 
68  public function getValue() {
69  return $this->value;
70  }
71 
77  public function getError(): string {
78  return $this->error;
79  }
80 
86  public function getMessage(): string {
87  return $this->message;
88  }
89 }
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
Definition: LICENSE.txt:215
$value
Definition: generic.php:51
getValue()
Get parameter valud.
$result message
$result error
getMessage()
Get success message.
__construct(protected string $name, protected $value)
Constructor.
Represents a parameter that has been validated.
fail(string $error= '')
Set parameter value as failing validation.
pass(string $message= '')
Set parameter value as passing validation.
isValid()
Is parameter value valid?