Completed
Pull Request — master (#193)
by
unknown
02:22
created

Value_Parser   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A parse() 0 3 1
A is_key_present() 0 3 3
A throw_exception() 0 3 1
1
<?php 
2
namespace Carbon_Fields\Updater;
3
4
/**
5
* Class for parsing input
6
*/
7
8
class Value_Parser {
9
	
10
	/**
11
	 * Prepare $input for carbon field
12
	 * 
13
	 * @param  array $input 
14
	 * @param  bool $is_option
15
	 * @return array $parsed_data
16
	 */
17
	public static function parse( $input, $is_option ) {
18
		return $input;
19
	}
20
21
	/**
22
	 * Check if a $key is set in $array and whether it has a value
23
	 * 
24
	 * @param  string  $key
25
	 * @param  array  $array
26
	 * @return boolean
27
	 */
28
	public static function is_key_present( $key, $array ) {
29
		return isset( $array[ $key ] ) && $array[ $key ] ? true : false;
30
	}
31
32
	/**
33
	 * Throw an exception
34
	 * 
35
	 * @param  string $message 
36
	 */
37
	public static function throw_exception( $message ) {
38
		throw new \Exception( $message );
39
	}	
40
}