Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
CheckData.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 
7 abstract class CheckData
8 {
9  /**
10  * @var array
11  */
12  protected $errors = array();
13  /**
14  * call it after check to see error message
15  * @return string error message
16  */
17  public function getErrors()
18  {
19  return implode("\n", $this->errors);
20  }
21  /**
22  * call it after check to see if error occurs
23  * @return bool
24  */
25  public function hasErrors()
26  {
27  return count($this->errors) > 0;
28  }
29  public function addError($msg)
30  {
31  if ($msg) {
32 
33  if (!in_array($msg, $this->errors)) {
34  $this->errors[] = $msg;
35  error_log("ERROR:" . $msg);
36  }
37  }
38  }
39  /**
40  * @abstract
41  * @param array $data
42  * @param null $extra
43  * @return CheckData this itself
44  */
45  public abstract function check(array $data, &$extra = null);
46 }
addError($msg)
Definition: CheckData.php:29
check(array $data, &$extra=null)
$data
← centre documentaire © anakeen