Total Complexity | 10 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
3 | class plProcessorOptions |
||
4 | { |
||
5 | const BOOL = 1; |
||
6 | const STRING = 2; |
||
7 | const DECIMAL = 3; |
||
8 | |||
9 | protected $properties = array(); |
||
10 | |||
11 | public function __get( $key ) |
||
12 | { |
||
13 | if ( !array_key_exists( $key, $this->properties ) ) |
||
14 | { |
||
15 | throw new plProcessorOptionException( $key, plProcessorOptionException::READ ); |
||
16 | } |
||
17 | return $this->properties[$key]['data']; |
||
18 | } |
||
19 | |||
20 | public function __set( $key, $val ) |
||
21 | { |
||
22 | if ( !array_key_exists( $key, $this->properties ) ) |
||
23 | { |
||
24 | throw new plProcessorOptionException( $key, plProcessorOptionException::WRITE ); |
||
25 | } |
||
26 | $this->properties[$key]['data'] = $val; |
||
27 | } |
||
28 | |||
29 | public function getOptions() |
||
37 | } |
||
38 | |||
39 | public function getOptionDescription( $option ) |
||
40 | { |
||
41 | if ( !array_key_exists( $option, $this->properties ) ) |
||
42 | { |
||
43 | throw new plProcessorOptionException( $option, plProcessorOptionException::UNKNOWN ); |
||
44 | } |
||
45 | return $this->properties[$option]['description']; |
||
46 | } |
||
47 | |||
48 | public function getOptionType( $option ) |
||
55 | } |
||
56 | } |
||
57 | |||
59 |
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.