File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ public function toSimpleObject()
111111 // Process all other data.
112112 foreach ($ this ->data as $ key => $ val ) {
113113 $ result = $ this ->getSimpleValue ($ val );
114- if ($ result != null ) {
114+ if ($ result !== null ) {
115115 $ object ->$ key = $ result ;
116116 }
117117 }
@@ -122,7 +122,7 @@ public function toSimpleObject()
122122 foreach ($ props as $ member ) {
123123 $ name = $ member ->getName ();
124124 $ result = $ this ->getSimpleValue ($ this ->$ name );
125- if ($ result != null ) {
125+ if ($ result !== null ) {
126126 $ object ->$ name = $ result ;
127127 }
128128 }
@@ -142,7 +142,7 @@ private function getSimpleValue($value)
142142 $ return = array ();
143143 foreach ($ value as $ key => $ a_value ) {
144144 $ a_value = $ this ->getSimpleValue ($ a_value );
145- if ($ a_value != null ) {
145+ if ($ a_value !== null ) {
146146 $ return [$ key ] = $ a_value ;
147147 }
148148 }
Original file line number Diff line number Diff line change @@ -80,7 +80,9 @@ public function testJsonStructure()
8080 $ model3 = new Google_Model ();
8181 $ model3 ->publicE = 54321 ;
8282 $ model3 ->publicF = null ;
83- $ model ->publicG = array ($ model3 , "hello " );
83+ $ model ->publicG = array ($ model3 , "hello " , false );
84+ $ model ->publicH = false ;
85+ $ model ->publicI = 0 ;
8486 $ string = json_encode ($ model ->toSimpleObject ());
8587 $ data = json_decode ($ string , true );
8688 $ this ->assertEquals (12345 , $ data ['publicB ' ]['publicC ' ]);
@@ -89,7 +91,10 @@ public function testJsonStructure()
8991 $ this ->assertArrayHasKey ("publicE " , $ data ['publicG ' ][0 ]);
9092 $ this ->assertArrayNotHasKey ("publicF " , $ data ['publicG ' ][0 ]);
9193 $ this ->assertEquals ("hello " , $ data ['publicG ' ][1 ]);
94+ $ this ->assertEquals (false , $ data ['publicG ' ][2 ]);
9295 $ this ->assertArrayNotHasKey ("data " , $ data );
96+ $ this ->assertEquals (false , $ data ['publicH ' ]);
97+ $ this ->assertEquals (0 , $ data ['publicI ' ]);
9398 }
9499
95100 public function testIssetPropertyOnModel ()
You can’t perform that action at this time.
0 commit comments