| Conditions | 3 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | 3 | public function validate(array $data = array()) |
|
| 35 | { |
||
| 36 | 3 | $this->load->library('form_validation'); |
|
|
|
|||
| 37 | |||
| 38 | 3 | ! empty($data) && $this->form_validation->set_data($data); |
|
| 39 | |||
| 40 | 3 | $this->form_validation->set_rules($this->validation_rules); |
|
| 41 | |||
| 42 | 3 | if (! ($validated = $this->form_validation->run())) { |
|
| 43 | 3 | $this->errors = $this->form_validation->error_array(); |
|
| 44 | 2 | } |
|
| 45 | |||
| 46 | 3 | return $validated; |
|
| 47 | } |
||
| 48 | |||
| 60 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: