@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | return static::$fields->all(); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public static function get($key, $default=null){ |
|
| 30 | + public static function get($key, $default = null) { |
|
| 31 | 31 | if (!static::$fields) static::$fields = new Map(); |
| 32 | - if (is_array($key)){ |
|
| 32 | + if (is_array($key)) { |
|
| 33 | 33 | $results = []; |
| 34 | 34 | foreach ($key as $_src_key => $_dst_key) |
| 35 | 35 | $results[$_dst_key] = static::$fields->get($_src_key); |
@@ -39,46 +39,46 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public static function set($key, $value=null){ |
|
| 42 | + public static function set($key, $value = null) { |
|
| 43 | 43 | if (!static::$fields) static::$fields = new Map(); |
| 44 | 44 | return static::$fields->set($key, $value); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public static function delete($key, $compact=true){ |
|
| 47 | + public static function delete($key, $compact = true) { |
|
| 48 | 48 | if (!static::$fields) static::$fields = new Map(); |
| 49 | 49 | static::$fields->delete($key, $compact); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public static function exists($key){ |
|
| 52 | + public static function exists($key) { |
|
| 53 | 53 | if (!static::$fields) static::$fields = new Map(); |
| 54 | 54 | return static::$fields->exists($key); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - public static function clear(){ |
|
| 57 | + public static function clear() { |
|
| 58 | 58 | if (!static::$fields) static::$fields = new Map(); |
| 59 | 59 | static::$fields->clear(); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public static function load($fields){ |
|
| 62 | + public static function load($fields) { |
|
| 63 | 63 | if (!static::$fields) static::$fields = new Map(); |
| 64 | 64 | static::$fields->load($fields); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - public static function merge(array $array, $merge_back=false){ |
|
| 67 | + public static function merge(array $array, $merge_back = false) { |
|
| 68 | 68 | if (!static::$fields) static::$fields = new Map(); |
| 69 | 69 | static::$fields->merge($array, $merge_back); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - protected static function compact(){ |
|
| 72 | + protected static function compact() { |
|
| 73 | 73 | if (!static::$fields) static::$fields = new Map(); |
| 74 | 74 | static::$fields->compact(); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - protected static function & find($path, $create=false, callable $operation=null) { |
|
| 77 | + protected static function & find($path, $create = false, callable $operation = null) { |
|
| 78 | 78 | return static::$fields->find($path, $create, $operation); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - public function jsonSerialize(){ |
|
| 81 | + public function jsonSerialize() { |
|
| 82 | 82 | if (!static::$fields) static::$fields = new Map(); |
| 83 | 83 | return static::$fields->jsonSerialize(); |
| 84 | 84 | } |
@@ -23,13 +23,17 @@ discard block |
||
| 23 | 23 | protected static $fields = null; |
| 24 | 24 | |
| 25 | 25 | public static function & all(){ |
| 26 | - if (!static::$fields) static::$fields = new Map(); |
|
| 26 | + if (!static::$fields) { |
|
| 27 | + static::$fields = new Map(); |
|
| 28 | + } |
|
| 27 | 29 | return static::$fields->all(); |
| 28 | 30 | } |
| 29 | 31 | |
| 30 | - public static function get($key, $default=null){ |
|
| 31 | - if (!static::$fields) static::$fields = new Map(); |
|
| 32 | - if (is_array($key)){ |
|
| 32 | + public static function get($key, $default=null) { |
|
| 33 | + if (!static::$fields) { |
|
| 34 | + static::$fields = new Map(); |
|
| 35 | + } |
|
| 36 | + if (is_array($key)) { |
|
| 33 | 37 | $results = []; |
| 34 | 38 | foreach ($key as $_src_key => $_dst_key) |
| 35 | 39 | $results[$_dst_key] = static::$fields->get($_src_key); |
@@ -39,38 +43,52 @@ discard block |
||
| 39 | 43 | } |
| 40 | 44 | } |
| 41 | 45 | |
| 42 | - public static function set($key, $value=null){ |
|
| 43 | - if (!static::$fields) static::$fields = new Map(); |
|
| 46 | + public static function set($key, $value=null) { |
|
| 47 | + if (!static::$fields) { |
|
| 48 | + static::$fields = new Map(); |
|
| 49 | + } |
|
| 44 | 50 | return static::$fields->set($key, $value); |
| 45 | 51 | } |
| 46 | 52 | |
| 47 | - public static function delete($key, $compact=true){ |
|
| 48 | - if (!static::$fields) static::$fields = new Map(); |
|
| 53 | + public static function delete($key, $compact=true) { |
|
| 54 | + if (!static::$fields) { |
|
| 55 | + static::$fields = new Map(); |
|
| 56 | + } |
|
| 49 | 57 | static::$fields->delete($key, $compact); |
| 50 | 58 | } |
| 51 | 59 | |
| 52 | - public static function exists($key){ |
|
| 53 | - if (!static::$fields) static::$fields = new Map(); |
|
| 60 | + public static function exists($key) { |
|
| 61 | + if (!static::$fields) { |
|
| 62 | + static::$fields = new Map(); |
|
| 63 | + } |
|
| 54 | 64 | return static::$fields->exists($key); |
| 55 | 65 | } |
| 56 | 66 | |
| 57 | - public static function clear(){ |
|
| 58 | - if (!static::$fields) static::$fields = new Map(); |
|
| 67 | + public static function clear() { |
|
| 68 | + if (!static::$fields) { |
|
| 69 | + static::$fields = new Map(); |
|
| 70 | + } |
|
| 59 | 71 | static::$fields->clear(); |
| 60 | 72 | } |
| 61 | 73 | |
| 62 | - public static function load($fields){ |
|
| 63 | - if (!static::$fields) static::$fields = new Map(); |
|
| 74 | + public static function load($fields) { |
|
| 75 | + if (!static::$fields) { |
|
| 76 | + static::$fields = new Map(); |
|
| 77 | + } |
|
| 64 | 78 | static::$fields->load($fields); |
| 65 | 79 | } |
| 66 | 80 | |
| 67 | - public static function merge(array $array, $merge_back=false){ |
|
| 68 | - if (!static::$fields) static::$fields = new Map(); |
|
| 81 | + public static function merge(array $array, $merge_back=false) { |
|
| 82 | + if (!static::$fields) { |
|
| 83 | + static::$fields = new Map(); |
|
| 84 | + } |
|
| 69 | 85 | static::$fields->merge($array, $merge_back); |
| 70 | 86 | } |
| 71 | 87 | |
| 72 | - protected static function compact(){ |
|
| 73 | - if (!static::$fields) static::$fields = new Map(); |
|
| 88 | + protected static function compact() { |
|
| 89 | + if (!static::$fields) { |
|
| 90 | + static::$fields = new Map(); |
|
| 91 | + } |
|
| 74 | 92 | static::$fields->compact(); |
| 75 | 93 | } |
| 76 | 94 | |
@@ -78,8 +96,10 @@ discard block |
||
| 78 | 96 | return static::$fields->find($path, $create, $operation); |
| 79 | 97 | } |
| 80 | 98 | |
| 81 | - public function jsonSerialize(){ |
|
| 82 | - if (!static::$fields) static::$fields = new Map(); |
|
| 99 | + public function jsonSerialize() { |
|
| 100 | + if (!static::$fields) { |
|
| 101 | + static::$fields = new Map(); |
|
| 102 | + } |
|
| 83 | 103 | return static::$fields->jsonSerialize(); |
| 84 | 104 | } |
| 85 | 105 | |