1 | <?php |
||
18 | class Conversion |
||
19 | { |
||
20 | /** |
||
21 | * Reduces any input to an ON/OFF value. |
||
22 | * |
||
23 | * @param mixed $input Data to convert |
||
24 | * @param mixed $default Fallback to use if $input is NULL |
||
25 | * @return string Either ON or OFF |
||
26 | */ |
||
27 | public static function onOff($input, $default = false) |
||
31 | |||
32 | /** |
||
33 | * Expands a single option to its unlimited counterpart if NULL or literal 'unlimited'. |
||
34 | * |
||
35 | * @param array $options Array of options to process |
||
36 | * @param string $key Key of the item to process |
||
37 | */ |
||
38 | protected static function processUnlimitedOption(array &$options, $key) |
||
46 | |||
47 | /** |
||
48 | * Detects package/domain options that can be unlimited and sets the accordingly. |
||
49 | * |
||
50 | * @param array $options |
||
51 | * @return array Modified array |
||
52 | */ |
||
53 | public static function processUnlimitedOptions(array $options) |
||
61 | |||
62 | /** |
||
63 | * Processes DirectAdmin style encoded responses into a sane array. |
||
64 | * |
||
65 | * @param string $data |
||
66 | * @return array |
||
67 | */ |
||
68 | public static function responseToArray($data) |
||
75 | |||
76 | /** |
||
77 | * Ensures a DA-style response element is wrapped properly as an array. |
||
78 | * |
||
79 | * @param mixed $result Messy input |
||
80 | * @return array Sane output |
||
81 | */ |
||
82 | public static function sanitizeArray($result) |
||
89 | |||
90 | /** |
||
91 | * Converts values like ON, YES etc. to proper boolean variables. |
||
92 | * |
||
93 | * @param mixed $value Value to be converted |
||
94 | * @param mixed $default Value to use if $value is NULL |
||
95 | * @return bool |
||
96 | */ |
||
97 | public static function toBool($value, $default = false) |
||
101 | } |
||
102 |