Skip to content

Commit 54853d7

Browse files
committed
Make castFields private
1 parent 9a07f3c commit 54853d7

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

src/GraphNode/GraphNode.php

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -199,36 +199,6 @@ public function __toString()
199199
return $this->asJson();
200200
}
201201

202-
/**
203-
* Iterates over an array and detects the types each node
204-
* should be cast to and returns all the fields as an array.
205-
*
206-
* @TODO Add auto-casting to AccessToken entities.
207-
*
208-
* @param array $data the array to iterate over
209-
*
210-
* @return array
211-
*/
212-
public function castFields(array $data)
213-
{
214-
$fields = [];
215-
216-
foreach ($data as $k => $v) {
217-
if ($this->shouldCastAsDateTime($k)
218-
&& (is_numeric($v)
219-
|| $this->isIso8601DateString($v))
220-
) {
221-
$fields[$k] = $this->castToDateTime($v);
222-
} elseif ($k === 'birthday') {
223-
$fields[$k] = $this->castToBirthday($v);
224-
} else {
225-
$fields[$k] = $v;
226-
}
227-
}
228-
229-
return $fields;
230-
}
231-
232202
/**
233203
* Uncasts any auto-casted datatypes.
234204
* Basically the reverse of castFields().
@@ -289,6 +259,36 @@ public static function getNodeMap()
289259
return static::$graphNodeMap;
290260
}
291261

262+
/**
263+
* Iterates over an array and detects the types each node
264+
* should be cast to and returns all the fields as an array.
265+
*
266+
* @TODO Add auto-casting to AccessToken entities.
267+
*
268+
* @param array $data the array to iterate over
269+
*
270+
* @return array
271+
*/
272+
private function castFields(array $data)
273+
{
274+
$fields = [];
275+
276+
foreach ($data as $k => $v) {
277+
if ($this->shouldCastAsDateTime($k)
278+
&& (is_numeric($v)
279+
|| $this->isIso8601DateString($v))
280+
) {
281+
$fields[$k] = $this->castToDateTime($v);
282+
} elseif ($k === 'birthday') {
283+
$fields[$k] = $this->castToBirthday($v);
284+
} else {
285+
$fields[$k] = $v;
286+
}
287+
}
288+
289+
return $fields;
290+
}
291+
292292
/**
293293
* Determines if a value from Graph should be cast to DateTime.
294294
*

0 commit comments

Comments
 (0)