@@ 118-122 (lines=5) @@ | ||
115 | $awardedBountyUsers = []; |
|
116 | $comments = []; |
|
117 | ||
118 | if (array_key_exists('tags', $data) && is_array($data['tags'])) { |
|
119 | foreach ($data['tags'] as $tag) { |
|
120 | $tags[] = AnemicTag::fromJson($tag); |
|
121 | } |
|
122 | } |
|
123 | if (array_key_exists('awarded_bounty_users', $data) && is_array($data['awarded_bounty_users'])) { |
|
124 | foreach ($data['awarded_bounty_users'] as $awardedBountyUser) { |
|
125 | $awardedBountyUsers[] = AnemicShallowUser::fromJson($awardedBountyUser); |
|
@@ 123-127 (lines=5) @@ | ||
120 | $tags[] = AnemicTag::fromJson($tag); |
|
121 | } |
|
122 | } |
|
123 | if (array_key_exists('awarded_bounty_users', $data) && is_array($data['awarded_bounty_users'])) { |
|
124 | foreach ($data['awarded_bounty_users'] as $awardedBountyUser) { |
|
125 | $awardedBountyUsers[] = AnemicShallowUser::fromJson($awardedBountyUser); |
|
126 | } |
|
127 | } |
|
128 | if (array_key_exists('comments', $data) && is_array($data['comments'])) { |
|
129 | foreach ($data['comments'] as $comment) { |
|
130 | $comments[] = AnemicComment::fromJson($comment); |
|
@@ 128-132 (lines=5) @@ | ||
125 | $awardedBountyUsers[] = AnemicShallowUser::fromJson($awardedBountyUser); |
|
126 | } |
|
127 | } |
|
128 | if (array_key_exists('comments', $data) && is_array($data['comments'])) { |
|
129 | foreach ($data['comments'] as $comment) { |
|
130 | $comments[] = AnemicComment::fromJson($comment); |
|
131 | } |
|
132 | } |
|
133 | ||
134 | return new self( |
|
135 | array_key_exists('answer_id', $data) ? $data['answer_id'] : null, |
@@ 46-50 (lines=5) @@ | ||
43 | { |
|
44 | $topAnswers = []; |
|
45 | $topQuestions = []; |
|
46 | if (array_key_exists('top_answers', $data) && is_array($data['top_answers'])) { |
|
47 | foreach ($data['top_answers'] as $topAnswer) { |
|
48 | $topAnswers[] = AnemicNetworkPost::fromJson($topAnswer); |
|
49 | } |
|
50 | } |
|
51 | if (array_key_exists('top_questions', $data) && is_array($data['top_questions'])) { |
|
52 | foreach ($data['top_questions'] as $topQuestion) { |
|
53 | $topQuestions[] = AnemicNetworkPost::fromJson($topQuestion); |
|
@@ 51-55 (lines=5) @@ | ||
48 | $topAnswers[] = AnemicNetworkPost::fromJson($topAnswer); |
|
49 | } |
|
50 | } |
|
51 | if (array_key_exists('top_questions', $data) && is_array($data['top_questions'])) { |
|
52 | foreach ($data['top_questions'] as $topQuestion) { |
|
53 | $topQuestions[] = AnemicNetworkPost::fromJson($topQuestion); |
|
54 | } |
|
55 | } |
|
56 | ||
57 | return new self( |
|
58 | array_key_exists('user_id', $data) ? $data['user_id'] : null, |