| @@ 115-119 (lines=5) @@ | ||
| 112 | $awardedBountyUsers = []; |
|
| 113 | $comments = []; |
|
| 114 | ||
| 115 | if (array_key_exists('tags', $data) && is_array($data['tags'])) { |
|
| 116 | foreach ($data['tags'] as $tag) { |
|
| 117 | $tags[] = Tag::fromJson($tag); |
|
| 118 | } |
|
| 119 | } |
|
| 120 | if (array_key_exists('awarded_bounty_users', $data) && is_array($data['awarded_bounty_users'])) { |
|
| 121 | foreach ($data['awarded_bounty_users'] as $awardedBountyUser) { |
|
| 122 | $awardedBountyUsers[] = ShallowUser::fromJson($awardedBountyUser); |
|
| @@ 120-124 (lines=5) @@ | ||
| 117 | $tags[] = Tag::fromJson($tag); |
|
| 118 | } |
|
| 119 | } |
|
| 120 | if (array_key_exists('awarded_bounty_users', $data) && is_array($data['awarded_bounty_users'])) { |
|
| 121 | foreach ($data['awarded_bounty_users'] as $awardedBountyUser) { |
|
| 122 | $awardedBountyUsers[] = ShallowUser::fromJson($awardedBountyUser); |
|
| 123 | } |
|
| 124 | } |
|
| 125 | if (array_key_exists('comments', $data) && is_array($data['comments'])) { |
|
| 126 | foreach ($data['comments'] as $comment) { |
|
| 127 | $comments[] = Comment::fromJson($comment); |
|
| @@ 125-129 (lines=5) @@ | ||
| 122 | $awardedBountyUsers[] = ShallowUser::fromJson($awardedBountyUser); |
|
| 123 | } |
|
| 124 | } |
|
| 125 | if (array_key_exists('comments', $data) && is_array($data['comments'])) { |
|
| 126 | foreach ($data['comments'] as $comment) { |
|
| 127 | $comments[] = Comment::fromJson($comment); |
|
| 128 | } |
|
| 129 | } |
|
| 130 | ||
| 131 | return new self( |
|
| 132 | array_key_exists('answer_id', $data) ? $data['answer_id'] : null, |
|
| @@ 43-47 (lines=5) @@ | ||
| 40 | { |
|
| 41 | $topAnswers = []; |
|
| 42 | $topQuestions = []; |
|
| 43 | if (array_key_exists('top_answers', $data) && is_array($data['top_answers'])) { |
|
| 44 | foreach ($data['top_answers'] as $topAnswer) { |
|
| 45 | $topAnswers[] = NetworkPost::fromJson($topAnswer); |
|
| 46 | } |
|
| 47 | } |
|
| 48 | if (array_key_exists('top_questions', $data) && is_array($data['top_questions'])) { |
|
| 49 | foreach ($data['top_questions'] as $topQuestion) { |
|
| 50 | $topQuestions[] = NetworkPost::fromJson($topQuestion); |
|
| @@ 48-52 (lines=5) @@ | ||
| 45 | $topAnswers[] = NetworkPost::fromJson($topAnswer); |
|
| 46 | } |
|
| 47 | } |
|
| 48 | if (array_key_exists('top_questions', $data) && is_array($data['top_questions'])) { |
|
| 49 | foreach ($data['top_questions'] as $topQuestion) { |
|
| 50 | $topQuestions[] = NetworkPost::fromJson($topQuestion); |
|
| 51 | } |
|
| 52 | } |
|
| 53 | ||
| 54 | return new self( |
|
| 55 | array_key_exists('user_id', $data) ? $data['user_id'] : null, |
|