@@ -3,55 +3,55 @@ |
||
3 | 3 | |
4 | 4 | class RefactorArray implements ArrayAccess, Countable |
5 | 5 | { |
6 | - /** |
|
7 | - * [private description] |
|
8 | - * @var [type] |
|
9 | - */ |
|
10 | - private $data = array(); |
|
11 | - /** |
|
12 | - * [offsetSet description] |
|
13 | - * @date 2019-11-02 |
|
14 | - * @param [type] $offset [description] |
|
15 | - * @param [type] $value [description] |
|
16 | - */ |
|
17 | - public function offsetSet($offset, $value) |
|
18 | - { |
|
6 | + /** |
|
7 | + * [private description] |
|
8 | + * @var [type] |
|
9 | + */ |
|
10 | + private $data = array(); |
|
11 | + /** |
|
12 | + * [offsetSet description] |
|
13 | + * @date 2019-11-02 |
|
14 | + * @param [type] $offset [description] |
|
15 | + * @param [type] $value [description] |
|
16 | + */ |
|
17 | + public function offsetSet($offset, $value) |
|
18 | + { |
|
19 | 19 | $this->data[$offset] = $value; |
20 | - } |
|
21 | - /** |
|
22 | - * [offsetExists description] |
|
23 | - * @date 2019-11-02 |
|
24 | - * @param [type] $offset [description] |
|
25 | - */ |
|
26 | - public function offsetExists($offset) |
|
27 | - { |
|
20 | + } |
|
21 | + /** |
|
22 | + * [offsetExists description] |
|
23 | + * @date 2019-11-02 |
|
24 | + * @param [type] $offset [description] |
|
25 | + */ |
|
26 | + public function offsetExists($offset) |
|
27 | + { |
|
28 | 28 | return isset($this->data[$offset]); |
29 | - } |
|
30 | - /** |
|
31 | - * [offsetUnset description] |
|
32 | - * @date 2019-11-02 |
|
33 | - * @param [type] $offset [description] |
|
34 | - */ |
|
35 | - public function offsetUnset($offset) |
|
36 | - { |
|
29 | + } |
|
30 | + /** |
|
31 | + * [offsetUnset description] |
|
32 | + * @date 2019-11-02 |
|
33 | + * @param [type] $offset [description] |
|
34 | + */ |
|
35 | + public function offsetUnset($offset) |
|
36 | + { |
|
37 | 37 | unset($this->data[$offset]); |
38 | - } |
|
39 | - /** |
|
40 | - * [offsetGet description] |
|
41 | - * @date 2019-11-02 |
|
42 | - * @param [type] $offset [description] |
|
43 | - */ |
|
44 | - public function offsetGet($offset) |
|
45 | - { |
|
38 | + } |
|
39 | + /** |
|
40 | + * [offsetGet description] |
|
41 | + * @date 2019-11-02 |
|
42 | + * @param [type] $offset [description] |
|
43 | + */ |
|
44 | + public function offsetGet($offset) |
|
45 | + { |
|
46 | 46 | return ($this->offsetExists($offset)) ? $this->data[$offset] : null; |
47 | - } |
|
48 | - /** |
|
49 | - * [count description] |
|
50 | - * @date 2019-11-02 |
|
51 | - * @return [type] [description] |
|
52 | - */ |
|
53 | - public function count() |
|
54 | - { |
|
47 | + } |
|
48 | + /** |
|
49 | + * [count description] |
|
50 | + * @date 2019-11-02 |
|
51 | + * @return [type] [description] |
|
52 | + */ |
|
53 | + public function count() |
|
54 | + { |
|
55 | 55 | return count($this->_data); |
56 | - } |
|
56 | + } |
|
57 | 57 | } |
@@ -5,90 +5,90 @@ |
||
5 | 5 | |
6 | 6 | class RefactorPayload |
7 | 7 | { |
8 | - protected $payload; |
|
9 | - /** |
|
10 | - * [__construct description] |
|
11 | - * @date 2019-11-02 |
|
12 | - * @param array $payload [description] |
|
13 | - */ |
|
14 | - public function __construct($payload=[]) |
|
15 | - { |
|
8 | + protected $payload; |
|
9 | + /** |
|
10 | + * [__construct description] |
|
11 | + * @date 2019-11-02 |
|
12 | + * @param array $payload [description] |
|
13 | + */ |
|
14 | + public function __construct($payload=[]) |
|
15 | + { |
|
16 | 16 | $this->payload = $payload; |
17 | - } |
|
18 | - /** |
|
19 | - * [__set description] |
|
20 | - * @date 2019-11-02 |
|
21 | - * @param string $key [description] |
|
22 | - * @param [type] $value [description] |
|
23 | - */ |
|
24 | - public function __set(string $key, $value):void |
|
25 | - { |
|
17 | + } |
|
18 | + /** |
|
19 | + * [__set description] |
|
20 | + * @date 2019-11-02 |
|
21 | + * @param string $key [description] |
|
22 | + * @param [type] $value [description] |
|
23 | + */ |
|
24 | + public function __set(string $key, $value):void |
|
25 | + { |
|
26 | 26 | if (is_object($this->payload)) { |
27 | - $this->payload->$key = $value; |
|
28 | - return; |
|
27 | + $this->payload->$key = $value; |
|
28 | + return; |
|
29 | 29 | } |
30 | 30 | $this->payload[$key] = $value; |
31 | - } |
|
32 | - /** |
|
33 | - * [__unset description] |
|
34 | - * @date 2019-11-02 |
|
35 | - * @param string $key [description] |
|
36 | - */ |
|
37 | - public function __unset(string $key):void |
|
38 | - { |
|
31 | + } |
|
32 | + /** |
|
33 | + * [__unset description] |
|
34 | + * @date 2019-11-02 |
|
35 | + * @param string $key [description] |
|
36 | + */ |
|
37 | + public function __unset(string $key):void |
|
38 | + { |
|
39 | 39 | if (is_object($this->payload)) { |
40 | - unset($this->payload->$key); |
|
41 | - return; |
|
40 | + unset($this->payload->$key); |
|
41 | + return; |
|
42 | 42 | } |
43 | 43 | unset($this->payload[$key]); |
44 | - } |
|
45 | - /** |
|
46 | - * [__get description] |
|
47 | - * @date 2019-11-02 |
|
48 | - * @param string $key [description] |
|
49 | - * @return [type] [description] |
|
50 | - */ |
|
51 | - public function __get(string $key) |
|
52 | - { |
|
44 | + } |
|
45 | + /** |
|
46 | + * [__get description] |
|
47 | + * @date 2019-11-02 |
|
48 | + * @param string $key [description] |
|
49 | + * @return [type] [description] |
|
50 | + */ |
|
51 | + public function __get(string $key) |
|
52 | + { |
|
53 | 53 | if (is_object($this->payload)) return $this->payload->$key; |
54 | 54 | return $this->payload[$key]; |
55 | - } |
|
56 | - /** |
|
57 | - * [__toString description] |
|
58 | - * @date 2019-11-03 |
|
59 | - * @return string [description] |
|
60 | - */ |
|
61 | - public function __toString():string |
|
62 | - { |
|
55 | + } |
|
56 | + /** |
|
57 | + * [__toString description] |
|
58 | + * @date 2019-11-03 |
|
59 | + * @return string [description] |
|
60 | + */ |
|
61 | + public function __toString():string |
|
62 | + { |
|
63 | 63 | return json_encode($this->payload); |
64 | - } |
|
65 | - /** |
|
66 | - * [setPayload description] |
|
67 | - * @date 2019-11-02 |
|
68 | - * @param [type] $payload [description] |
|
69 | - */ |
|
70 | - public function setPayload($payload):void |
|
71 | - { |
|
64 | + } |
|
65 | + /** |
|
66 | + * [setPayload description] |
|
67 | + * @date 2019-11-02 |
|
68 | + * @param [type] $payload [description] |
|
69 | + */ |
|
70 | + public function setPayload($payload):void |
|
71 | + { |
|
72 | 72 | $this->payload = $payload; |
73 | - } |
|
74 | - /** |
|
75 | - * [set_payload description] |
|
76 | - * @date 2019-11-02 |
|
77 | - * @param array $payload [description] |
|
78 | - */ |
|
79 | - public function switchPayload(&$payload):void |
|
80 | - { |
|
73 | + } |
|
74 | + /** |
|
75 | + * [set_payload description] |
|
76 | + * @date 2019-11-02 |
|
77 | + * @param array $payload [description] |
|
78 | + */ |
|
79 | + public function switchPayload(&$payload):void |
|
80 | + { |
|
81 | 81 | $this->payload =& $payload; |
82 | - } |
|
83 | - /** |
|
84 | - * [toArray description] |
|
85 | - * @date 2019-11-02 |
|
86 | - * @return array [description] |
|
87 | - */ |
|
88 | - public function toArray():array |
|
89 | - { |
|
82 | + } |
|
83 | + /** |
|
84 | + * [toArray description] |
|
85 | + * @date 2019-11-02 |
|
86 | + * @return array [description] |
|
87 | + */ |
|
88 | + public function toArray():array |
|
89 | + { |
|
90 | 90 | if (is_array($this->payload)) return $this->payload; |
91 | 91 | return json_decode(json_encode($this->payload), true); |
92 | - } |
|
92 | + } |
|
93 | 93 | } |
94 | 94 | ?> |