-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathValidate.class.php
More file actions
47 lines (32 loc) · 918 Bytes
/
Validate.class.php
File metadata and controls
47 lines (32 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* Created by PhpStorm.
* User: josec
* Date: 19/09/2014
* Time: 16:05
*/
class Validate {
public $vals;
function __construct($vals) {
$this->vals = $vals;
}
/**
* @param $valname
* @return mixed
*/
public function basic($valname) {
if(!isset($this->vals[$valname]) || $this->vals[$valname] == "" || $this->vals[$valname] == null){
throw new InvalidArgumentException(
'One or more fields are either empty or invalid.'
);
} else {
return $this->vals[$valname];
}
}
public function greaterThan($minSize, $maxSize ) {
if($maxSize < $minSize){
$error = '<h2 style="color: red;">The minimum size is bigger than the maximum size. Change that please!</h2>';
return $error;
}
}
}