| @@ 127-131 (lines=5) @@ | ||
| 124 | $awardedBountyUsers = []; |
|
| 125 | $comments = []; |
|
| 126 | ||
| 127 | if (array_key_exists('tags', $data) && is_array($data['tags'])) { |
|
| 128 | foreach ($data['tags'] as $tag) { |
|
| 129 | $tags[] = Tag::fromJson($tag); |
|
| 130 | } |
|
| 131 | } |
|
| 132 | if (array_key_exists('awarded_bounty_users', $data) && is_array($data['awarded_bounty_users'])) { |
|
| 133 | foreach ($data['awarded_bounty_users'] as $awardedBountyUser) { |
|
| 134 | $awardedBountyUsers[] = ShallowUser::fromJson($awardedBountyUser); |
|
| @@ 132-136 (lines=5) @@ | ||
| 129 | $tags[] = Tag::fromJson($tag); |
|
| 130 | } |
|
| 131 | } |
|
| 132 | if (array_key_exists('awarded_bounty_users', $data) && is_array($data['awarded_bounty_users'])) { |
|
| 133 | foreach ($data['awarded_bounty_users'] as $awardedBountyUser) { |
|
| 134 | $awardedBountyUsers[] = ShallowUser::fromJson($awardedBountyUser); |
|
| 135 | } |
|
| 136 | } |
|
| 137 | if (array_key_exists('comments', $data) && is_array($data['comments'])) { |
|
| 138 | foreach ($data['comments'] as $comment) { |
|
| 139 | $comments[] = Comment::fromJson($comment); |
|
| @@ 137-141 (lines=5) @@ | ||
| 134 | $awardedBountyUsers[] = ShallowUser::fromJson($awardedBountyUser); |
|
| 135 | } |
|
| 136 | } |
|
| 137 | if (array_key_exists('comments', $data) && is_array($data['comments'])) { |
|
| 138 | foreach ($data['comments'] as $comment) { |
|
| 139 | $comments[] = Comment::fromJson($comment); |
|
| 140 | } |
|
| 141 | } |
|
| 142 | ||
| 143 | $instance = new self(); |
|
| 144 | $instance |
|
| @@ 60-64 (lines=5) @@ | ||
| 57 | $instance = new self(); |
|
| 58 | ||
| 59 | $byUsers = []; |
|
| 60 | if (array_key_exists('by_users', $data) && is_array($data['by_users'])) { |
|
| 61 | foreach ($data['by_users'] as $byUser) { |
|
| 62 | $byUsers[] = ShallowUser::fromJson($byUser); |
|
| 63 | } |
|
| 64 | } |
|
| 65 | $originalQuestions = []; |
|
| 66 | if (array_key_exists('original_questions', $data) && is_array($data['original_questions'])) { |
|
| 67 | foreach ($data['original_questions'] as $originalQuestion) { |
|
| @@ 66-70 (lines=5) @@ | ||
| 63 | } |
|
| 64 | } |
|
| 65 | $originalQuestions = []; |
|
| 66 | if (array_key_exists('original_questions', $data) && is_array($data['original_questions'])) { |
|
| 67 | foreach ($data['original_questions'] as $originalQuestion) { |
|
| 68 | $originalQuestions[] = ShallowUser::fromJson($originalQuestion); |
|
| 69 | } |
|
| 70 | } |
|
| 71 | ||
| 72 | $instance |
|
| 73 | ->setByUsers($byUsers) |
|
| @@ 53-57 (lines=5) @@ | ||
| 50 | public static function fromJson(array $data) |
|
| 51 | { |
|
| 52 | $tags = []; |
|
| 53 | if (array_key_exists('tags', $data) && is_array($data['tags'])) { |
|
| 54 | foreach ($data['tags'] as $tag) { |
|
| 55 | $tags[] = Tag::fromJson($tag); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| 59 | $instance = new self(); |
|
| 60 | $instance |
|
| @@ 50-54 (lines=5) @@ | ||
| 47 | { |
|
| 48 | $topAnswers = []; |
|
| 49 | $topQuestions = []; |
|
| 50 | if (array_key_exists('top_answers', $data) && is_array($data['top_answers'])) { |
|
| 51 | foreach ($data['top_answers'] as $topAnswer) { |
|
| 52 | $topAnswers[] = NetworkPost::fromJson($topAnswer); |
|
| 53 | } |
|
| 54 | } |
|
| 55 | if (array_key_exists('top_questions', $data) && is_array($data['top_questions'])) { |
|
| 56 | foreach ($data['top_questions'] as $topQuestion) { |
|
| 57 | $topQuestions[] = NetworkPost::fromJson($topQuestion); |
|
| @@ 55-59 (lines=5) @@ | ||
| 52 | $topAnswers[] = NetworkPost::fromJson($topAnswer); |
|
| 53 | } |
|
| 54 | } |
|
| 55 | if (array_key_exists('top_questions', $data) && is_array($data['top_questions'])) { |
|
| 56 | foreach ($data['top_questions'] as $topQuestion) { |
|
| 57 | $topQuestions[] = NetworkPost::fromJson($topQuestion); |
|
| 58 | } |
|
| 59 | } |
|
| 60 | ||
| 61 | $instance = new self(); |
|
| 62 | $instance |
|
| @@ 59-63 (lines=5) @@ | ||
| 56 | public static function fromJson(array $data) |
|
| 57 | { |
|
| 58 | $comments = []; |
|
| 59 | if (array_key_exists('comments', $data) && is_array($data['comments'])) { |
|
| 60 | foreach ($data['comments'] as $comment) { |
|
| 61 | $comments[] = Comment::fromJson($comment); |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||
| 65 | $instance = new self(); |
|
| 66 | $instance |
|
| @@ 78-82 (lines=5) @@ | ||
| 75 | public static function fromJson(array $data) |
|
| 76 | { |
|
| 77 | $answers = []; |
|
| 78 | if (array_key_exists('answers', $data) && is_array($data['answers'])) { |
|
| 79 | foreach ($data['answers'] as $answer) { |
|
| 80 | $answers[] = Answer::fromJson($answer); |
|
| 81 | } |
|
| 82 | } |
|
| 83 | $comments = []; |
|
| 84 | if (array_key_exists('comments', $data) && is_array($data['comments'])) { |
|
| 85 | foreach ($data['comments'] as $comment) { |
|
| @@ 84-88 (lines=5) @@ | ||
| 81 | } |
|
| 82 | } |
|
| 83 | $comments = []; |
|
| 84 | if (array_key_exists('comments', $data) && is_array($data['comments'])) { |
|
| 85 | foreach ($data['comments'] as $comment) { |
|
| 86 | $comments[] = Comment::fromJson($comment); |
|
| 87 | } |
|
| 88 | } |
|
| 89 | $tags = []; |
|
| 90 | if (array_key_exists('tags', $data) && is_array($data['tags'])) { |
|
| 91 | foreach ($data['tags'] as $tag) { |
|
| @@ 90-94 (lines=5) @@ | ||
| 87 | } |
|
| 88 | } |
|
| 89 | $tags = []; |
|
| 90 | if (array_key_exists('tags', $data) && is_array($data['tags'])) { |
|
| 91 | foreach ($data['tags'] as $tag) { |
|
| 92 | $tags[] = Tag::fromJson($tag); |
|
| 93 | } |
|
| 94 | } |
|
| 95 | ||
| 96 | $instance = new self(); |
|
| 97 | $instance |
|
| @@ 112-116 (lines=5) @@ | ||
| 109 | } |
|
| 110 | } |
|
| 111 | $relatedSites = []; |
|
| 112 | if (array_key_exists('related_sites', $data) && is_array($data['related_sites'])) { |
|
| 113 | foreach ($data['related_sites'] as $relatedSite) { |
|
| 114 | $relatedSites[] = RelatedSite::fromJson($relatedSite); |
|
| 115 | } |
|
| 116 | } |
|
| 117 | ||
| 118 | $instance = new self(); |
|
| 119 | $instance |
|