MY_Form_validation::reset()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 7
nc 2
nop 0
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
ccs 7
cts 7
cp 1
crap 2
1
<?php
2
3
/**
4
 * Add some convenience methods to form_validation library
5
 */
6
class MY_Form_validation extends CI_Form_validation {
7
8
	/**
9
	 * Returns an array of errors for the current form
10
	 *
11
	 * @return array
12
	 */
13 7
	public function get_error_array()
14
	{
15 7
		return array_values($this->_error_array);
16
	}
17
18
	/**
19
	 * Clears out object data
20
	 *
21
	 * @return void
22
	 */
23 11
	public function reset()
24
	{
25
		foreach([
26 11
			'_field_data',
27 11
			'_error_array',
28
			'_error_messages'
29 11
		] as $var) {
30 11
			$this->$var = array();
31 11
		}
32 11
	}
33
}
34
// End of libraries/MY_Form_validation.php