Skip to content

Commit f64d9bb

Browse files
committed
Renamed 'data' to 'modelData'
Resources containing a 'data' field were incorrectly created because of the clash in the variable name.
1 parent 69d4769 commit f64d9bb

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/Google/Model.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*/
2626
class Google_Model implements ArrayAccess
2727
{
28-
protected $data = array();
28+
protected $modelData = array();
2929
protected $processed = array();
3030

3131
/**
@@ -46,33 +46,33 @@ public function __get($key)
4646
$keyTypeName = $this->keyType($key);
4747
$keyDataType = $this->dataType($key);
4848
if (isset($this->$keyTypeName) && !isset($this->processed[$key])) {
49-
if (isset($this->data[$key])) {
50-
$val = $this->data[$key];
49+
if (isset($this->modelData[$key])) {
50+
$val = $this->modelData[$key];
5151
} else {
5252
$val = null;
5353
}
5454

5555
if ($this->isAssociativeArray($val)) {
5656
if (isset($this->$keyDataType) && 'map' == $this->$keyDataType) {
5757
foreach ($val as $arrayKey => $arrayItem) {
58-
$this->data[$key][$arrayKey] =
58+
$this->modelData[$key][$arrayKey] =
5959
$this->createObjectFromName($keyTypeName, $arrayItem);
6060
}
6161
} else {
62-
$this->data[$key] = $this->createObjectFromName($keyTypeName, $val);
62+
$this->modelData[$key] = $this->createObjectFromName($keyTypeName, $val);
6363
}
6464
} else if (is_array($val)) {
6565
$arrayObject = array();
6666
foreach ($val as $arrayIndex => $arrayItem) {
6767
$arrayObject[$arrayIndex] =
6868
$this->createObjectFromName($keyTypeName, $arrayItem);
6969
}
70-
$this->data[$key] = $arrayObject;
70+
$this->modelData[$key] = $arrayObject;
7171
}
7272
$this->processed[$key] = true;
7373
}
7474

75-
return $this->data[$key];
75+
return $this->modelData[$key];
7676
}
7777

7878
/**
@@ -95,7 +95,7 @@ protected function mapTypes($array)
9595
$this->$camelKey = $val;
9696
}
9797
}
98-
$this->data = $array;
98+
$this->modelData = $array;
9999
}
100100

101101
/**
@@ -109,7 +109,7 @@ public function toSimpleObject()
109109
$object = new stdClass();
110110

111111
// Process all other data.
112-
foreach ($this->data as $key => $val) {
112+
foreach ($this->modelData as $key => $val) {
113113
$result = $this->getSimpleValue($val);
114114
if ($result !== null) {
115115
$object->$key = $result;
@@ -200,7 +200,7 @@ public function assertIsArray($obj, $method)
200200

201201
public function offsetExists($offset)
202202
{
203-
return isset($this->$offset) || isset($this->data[$offset]);
203+
return isset($this->$offset) || isset($this->modelData[$offset]);
204204
}
205205

206206
public function offsetGet($offset)
@@ -215,14 +215,14 @@ public function offsetSet($offset, $value)
215215
if (property_exists($this, $offset)) {
216216
$this->$offset = $value;
217217
} else {
218-
$this->data[$offset] = $value;
218+
$this->modelData[$offset] = $value;
219219
$this->processed[$offset] = true;
220220
}
221221
}
222222

223223
public function offsetUnset($offset)
224224
{
225-
unset($this->data[$offset]);
225+
unset($this->modelData[$offset]);
226226
}
227227

228228
protected function keyType($key)
@@ -237,11 +237,11 @@ protected function dataType($key)
237237

238238
public function __isset($key)
239239
{
240-
return isset($this->data[$key]);
240+
return isset($this->modelData[$key]);
241241
}
242242

243243
public function __unset($key)
244244
{
245-
unset($this->data[$key]);
245+
unset($this->modelData[$key]);
246246
}
247247
}

0 commit comments

Comments
 (0)