public function testReturningACollectionAsJasonWillSafelyRepresentDateTimes() { $collection = new GraphNode(['id' => '123', 'date' => new \DateTime('2014-07-15T03:44:53+0000')]); $collectionAsString = $collection->asJson(); $this->assertEquals('{"id":"123","date":"2014-07-15T03:44:53+0000"}', $collectionAsString); }
public function extractBiggestImageFromNode(GraphNode $node) { if ($node->offsetExists(0)) { return $node->offsetGet(0)['source']; } else { foreach ($node as $image) { return $image['source']; } } return null; }