Skip to content

Commit 5d6a270

Browse files
authored
Add equals() and not_equals()
1 parent e66c5ef commit 5d6a270

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

system/Validation/Rules.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@ public function differs(string $str = null, string $field, array $data): bool
6565

6666
//--------------------------------------------------------------------
6767

68+
/**
69+
* Equals the static value provided.
70+
*
71+
* @param string $str
72+
* @param string $str
73+
*
74+
* @return boolean
75+
*/
76+
public function equals(string $str = null, string $val): bool
77+
{
78+
return $str === $val;
79+
}
80+
81+
//--------------------------------------------------------------------
82+
6883
/**
6984
* Returns true if $str is $val characters long.
7085
* $val = "5" (one) | "5,8,12" (multiple values)
@@ -261,6 +276,21 @@ public function min_length(string $str = null, string $val, array $data): bool
261276

262277
//--------------------------------------------------------------------
263278

279+
/**
280+
* Does not equal the static value provided.
281+
*
282+
* @param string $str
283+
* @param string $str
284+
*
285+
* @return boolean
286+
*/
287+
public function not_equals(string $str = null, string $val): bool
288+
{
289+
return $str !== $val;
290+
}
291+
292+
//--------------------------------------------------------------------
293+
264294
/**
265295
* Required
266296
*

0 commit comments

Comments
 (0)