private function article($id)
{
$johnSmith = null;
$article = function ($id) use(&$johnSmith) {
return ['id' => $id, 'isPublished' => 'true', 'author' => $johnSmith, 'title' => 'My Article ' . $id, 'body' => 'This is a post', 'hidden' => 'This data is not exposed in the schema', 'keywords' => ['foo', 'bar', 1, true, null]];
};
$getPic = function ($uid, $width, $height) {
return ['url' => "cdn://{$uid}", 'width' => $width, 'height' => $height];
};
$johnSmith = ['id' => 123, 'name' => 'John Smith', 'pic' => function ($width, $height) use($getPic) {
return $getPic(123, $width, $height);
}, 'recentArticle' => $article(1)];
return $article($id);
}