/**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->accessToken = Util::setIfStringExists($json, 'access_token');
     $this->accountId = Util::setIfStringExists($json, 'account_id');
     $this->expiresOnDate = Util::setIfDateTimeExists($json, 'expires_on_date');
     $this->scope = Util::setIfArrayExists($json, 'scope');
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     parent::__construct($json);
     $this->communityOwnedDate = Util::setIfDateTimeExists($json, 'community_owned_date');
     $this->lockedDate = Util::setIfDateTimeExists($json, 'lockedDate');
     $this->tags = Util::setIfArrayExists($json, 'tags');
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->answersPerMinute = Util::setIfIntegerExists($json, 'answers_per_minute');
     $this->apiRevision = Util::setIfStringExists($json, 'api_revision');
     $this->badgesPerMinute = Util::setIfIntegerExists($json, 'badges_per_minute');
     $this->newActiveUsers = Util::setIfIntegerExists($json, 'new_active_users');
     $this->questionsPerMinute = Util::setIfIntegerExists($json, 'questions_per_minute');
     $this->site = new Site(Util::setIfArrayExists($json, 'site'));
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->body = Util::setIfStringExists($json, 'body');
     $this->bodyMarkDown = Util::setIfStringExists($json, 'body_markdown');
     $this->creationDate = Util::setIfDateTimeExists($json, 'creation_date');
     $this->link = Util::setIfStringExists($json, 'link');
     $this->owner = new ShallowUser(Util::setIfArrayExists($json, 'owner'));
     $this->score = Util::setIfIntegerExists($json, 'score');
     $this->upvoted = Util::setIfBoolExists($json, 'upvoted');
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->body = Util::setIfStringExists($json, 'body');
     $this->bodyLastEditDate = Util::setIfDateTimeExists($json, 'body_last_edit_date');
     $this->excerpt = Util::setIfStringExists($json, 'excerpt');
     $this->excerptLastEditDate = Util::setIfDateTimeExists($json, 'excerpt_last_edit_date');
     $this->lastBodyEditor = new ShallowUser(Util::setIfArrayExists($json, 'last_body_editor'));
     $this->lastExcerptEditor = new ShallowUser(Util::setIfArrayExists($json, 'last_excerpt_editor'));
     $this->tagName = Util::setIfStringExists($json, 'tag_name');
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     parent::__construct($json);
     $this->id = Util::setIfIntegerExists($json, 'comment_id');
     $this->canFlag = Util::setIfBoolExists($json, 'can_flag');
     $this->edited = Util::setIfBoolExists($json, 'edited');
     $this->postId = Util::setIfIntegerExists($json, 'post_id');
     $this->postType = Util::isEqual($json, 'post_type', [self::POST_TYPE_ANSWER, self::POST_TYPE_QUESTION]);
     $this->replyToUser = new ShallowUser(Util::setIfArrayExists($json, 'reply_to_user'));
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->id = Util::setIfIntegerExists($json, 'badge_id');
     $this->awardCount = Util::setIfIntegerExists($json, 'award_count');
     $this->description = Util::setIfStringExists($json, 'description');
     $this->name = Util::setIfStringExists($json, 'name');
     $this->badgeType = Util::isEqual($json, 'badge_type', [self::BADGE_TYPE_NAMED, self::BADGE_TYPE_TAG_BASED]);
     $this->link = Util::setIfStringExists($json, 'link');
     $this->rank = Util::isEqual($json, 'rank', [self::RANK_GOLD, self::RANK_BRONZE, self::RANK_SILVER]);
     $this->user = new ShallowUser(Util::setIfArrayExists($json, 'user'));
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->id = Util::setIfIntegerExists($json, 'user_id');
     $this->acceptRate = Util::setIfIntegerExists($json, 'accept_rate');
     $this->badgeCount = new BadgeCount(Util::setIfArrayExists($json, 'badge_count'));
     $this->displayName = Util::setIfStringExists($json, 'display_name');
     $this->link = Util::setIfStringExists($json, 'link');
     $this->profileImage = Util::setIfStringExists($json, 'profile_image');
     $this->reputation = Util::setIfIntegerExists($json, 'reputation');
     $this->userType = Util::isEqual($json, 'user_type', [self::USER_TYPE_DOES_NOT_EXIST, self::USER_TYPE_MODERATOR, self::USER_TYPE_REGISTERED, self::USER_TYPE_UNREGISTERED]);
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->count = Util::setIfIntegerExists($json, 'count');
     $this->hasSynonyms = Util::setIfBoolExists($json, 'has_synonyms');
     $this->isModeratorOnly = Util::setIfBoolExists($json, 'is_moderator_only');
     $this->isRequired = Util::setIfBoolExists($json, 'is_required');
     $this->lastActivityDate = Util::setIfDateTimeExists($json, 'last_activity_date');
     $this->name = Util::setIfStringExists($json, 'name');
     $this->synonyms = Util::setIfArrayExists($json, 'synonyms');
     $this->userId = Util::setIfIntegerExists($json, 'user_id');
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->count = Util::setIfIntegerExists($json, 'count');
     $this->description = Util::setIfStringExists($json, 'description');
     $this->dialogTitle = Util::setIfStringExists($json, 'dialog_title');
     $this->hasFlagged = Util::setIfBoolExists($json, 'has_flagged');
     $this->optionId = Util::setIfIntegerExists($json, 'option_id');
     $subOptions = Util::setIfArrayExists($json, 'sub_options');
     foreach ($subOptions as $subOption) {
         $this->subOptions[] = new self($subOption);
     }
     $this->title = Util::setIfStringExists($json, 'title');
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $users = Util::setIfArrayExists($json, 'by_users');
     foreach ($users as $user) {
         $this->byUsers[] = new ShallowUser($user);
     }
     $this->description = Util::setIfStringExists($json, 'description');
     $this->onHold = Util::setIfBoolExists($json, 'on_hold');
     $originalQuestions = Util::setIfArrayExists($json, 'original_questions');
     foreach ($originalQuestions as $originalQuestion) {
         $this->originalQuestions[] = new OriginalQuestion($originalQuestion);
     }
     $this->reason = Util::setIfStringExists($json, 'reason');
 }
 /**
  * Loads the variables if the data exist into resource. It works like a constructor.
  *
  * @param null|mixed[] $resource The resource
  */
 protected function loadEdit($resource)
 {
     $this->lastEditDate = Util::setIfDateTimeExists($resource, 'last_edit_date');
     $this->lastEditor = new ShallowUser(Util::setIfArrayExists($resource, 'last_editor'));
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->loadBetaDate($json);
     $this->loadSite($json, [self::SITE_STATE_CLOSED_BETA, self::SITE_STATE_LINKED_META, self::SITE_STATE_NORMAL, self::SITE_STATE_OPEN_BETA], [self::SITE_TYPE_MAIN_SITE, self::SITE_TYPE_META_SITE]);
     $this->loadUrl($json);
     $this->aliases = Util::setIfArrayExists($json, 'aliases');
     $this->apiSiteParameter = Util::setIfStringExists($json, 'api_site_parameter');
     $this->audience = Util::setIfStringExists($json, 'audience');
     $this->launchDate = Util::setIfDateTimeExists($json, 'launch_date');
     $this->markdownExtensions = Util::setIfArrayExists($json, 'markdown_extensions');
     $this->name = Util::setIfStringExists($json, 'name');
     $this->styling = new Styling(Util::setIfArrayExists($json, 'styling'));
     $this->twitterAccount = Util::setIfStringExists($json, 'twitter_account');
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->filter = Util::setIfStringExists($json, 'filter');
     $this->filterType = Util::isEqual($json, 'filter_type', [self::FILTER_TYPE_INVALID, self::FILTER_TYPE_SAFE, self::FILTER_TYPE_UNSAFE]);
     $this->includedFields = Util::setIfArrayExists($json, 'included_fields');
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     parent::__construct($json);
     $this->id = Util::setIfIntegerExists($json, 'question_id');
     $this->loadAnswer($json);
     $this->loadAnswered($json);
     $this->loadBounty($json);
     $this->loadClose($json);
     $this->loadFavorite($json);
     $this->loadMigration($json);
     $answers = Util::setIfArrayExists($json, 'answers');
     foreach ($answers as $answer) {
         $this->answers[] = new Answer($answer);
     }
     $this->canFlag = Util::setIfBoolExists($json, 'can_flag');
     $this->deleteVoteCount = Util::setIfIntegerExists($json, 'delete_vote_count');
     $this->notice = new Notice(Util::setIfArrayExists($json, 'notice'));
     $this->protectedDate = Util::setIfDateTimeExists($json, 'protected_date');
     $this->reopenVoteCount = Util::setIfIntegerExists($json, 'reopen_vote_count');
     $this->viewCount = Util::setIfIntegerExists($json, 'view_count');
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     parent::__construct($json);
     $this->loadLast($json);
     $this->loadRevision($json, [self::REVISION_TYPE_SINGLE_USER, self::REVISION_TYPE_VOTE_BASED]);
     $this->body = Util::setIfStringExists($json, 'body');
     $this->comment = Util::setIfStringExists($json, 'comment');
     $this->rollback = Util::setIfBoolExists($json, 'is_rollback');
     $this->postId = Util::setIfIntegerExists($json, 'post_id');
     $this->postType = Util::isEqual($json, 'post_type', [self::POST_TYPE_QUESTION, self::POST_TYPE_ANSWER]);
     $this->setCommunityWiki = Util::setIfBoolExists($json, 'set_community_wiki');
     $this->user = new ShallowUser(Util::setIfArrayExists($json, 'user'));
 }
 /**
  * Loads the variables if the data exist into resource. It works like a constructor.
  *
  * @param null|mixed[] $resource The resource
  */
 protected function loadCount($resource)
 {
     $this->answerCount = Util::setIfIntegerExists($resource, 'answer_count');
     $this->badgeCount = new BadgeCount(Util::setIfArrayExists($resource, 'badge_counts'));
     $this->questionCount = Util::setIfIntegerExists($resource, 'question_count');
 }
 /**
  * Loads the variables if the data exist into resource. It works like a constructor.
  *
  * @param null|mixed[] $resource The resource
  */
 protected function loadMigration($resource)
 {
     $this->migratedFrom = new MigrationInfo(Util::setIfArrayExists($resource, 'migrated_from'));
     $this->migratedTo = new MigrationInfo(Util::setIfArrayExists($resource, 'migrated_to'));
 }
 /**
  * Loads the variables if the data exist into resource. It works like a constructor.
  *
  * @param null|mixed[] $resource The resource
  */
 protected function loadCommentCount($resource)
 {
     $this->commentCount = Util::setIfIntegerExists($resource, 'comment_count');
     $comments = Util::setIfArrayExists($resource, 'comments');
     foreach ($comments as $comment) {
         $this->comments[] = new Comment($comment);
     }
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->loadGenericId($json);
     $this->commentId = Util::setIfIntegerExists($json, 'comment_id');
     $this->creationDate = Util::setIfDateTimeExists($json, 'creation_date');
     $this->isUnread = Util::setIfBoolExists($json, 'is_unread');
     $this->itemType = Util::isEqual($json, 'item_type', [self::ITEM_TYPE_CAREERS_INVITATIONS, self::ITEM_TYPE_CAREERS_MESSAGE, self::ITEM_TYPE_CHAT_MESSAGE, self::ITEM_TYPE_COMMENT, self::ITEM_TYPE_META_QUESTION, self::ITEM_TYPE_MODERATOR_MESSAGE, self::ITEM_TYPE_NEW_ANSWER, self::ITEM_TYPE_POST_NOTICE]);
     $this->link = Util::setIfStringExists($json, 'link');
     $this->site = new Site(Util::setIfArrayExists($json, 'site'));
     $this->title = Util::setIfStringExists($json, 'title');
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->postCount = Util::setIfIntegerExists($json, 'post_count');
     $this->score = Util::setIfIntegerExists($json, 'score');
     $this->user = new ShallowUser(Util::setIfArrayExists($json, 'user'));
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     parent::__construct($json);
     $this->loadAnswered($json);
     $this->loadGenericId($json);
     $this->answerCount = Util::setIfIntegerExists($json, 'answer_count');
     $this->closedDate = Util::setIfDateTimeExists($json, 'closed_date');
     $this->communityOwnedDate = Util::setIfDateTimeExists($json, 'community_owned_date');
     $this->equivalentTagsSearch = Util::setIfArrayExists($json, 'equivalent_tag_search');
     $this->excerpt = Util::setIfStringExists($json, 'excerpt');
     $this->hasAcceptedAnswer = Util::setIfBoolExists($json, 'has_accepted_answer');
     $this->isAccepted = Util::setIfBoolExists($json, 'is_accepted');
     $this->itemType = Util::isEqual($json, 'item_type', [self::ITEM_TYPE_ANSWER, self::ITEM_TYPE_QUESTION]);
     $this->lastActivityDate = Util::setIfDateTimeExists($json, 'last_activity_date');
     $this->lastActivityUser = new ShallowUser(Util::setIfArrayExists($json, 'last_activity_user'));
     $this->lockedDate = Util::setIfDateTimeExists($json, 'locked_date');
     $this->owner = new ShallowUser(Util::setIfArrayExists($json, 'owner'));
     $this->questionScore = Util::setIfIntegerExists($json, 'question_score');
     $this->score = Util::setIfIntegerExists($json, 'score');
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->body = Util::setIfStringExists($json, 'body');
     $this->creationDate = Util::setIfDateTimeExists($json, 'creation_date');
     $this->isUnread = Util::setIfBoolExists($json, 'is_unread');
     $this->notificationType = Util::isEqual($json, 'notification_type', [self::NOTIFICATION_TYPE_ACCOUNTS_ASSOCIATED, self::NOTIFICATION_TYPE_BADGE_EARNED, self::NOTIFICATION_TYPE_BOUNTY_EXPIRED, self::NOTIFICATION_TYPE_BOUNTY_EXPIRES_IN_ONE_DAY, self::NOTIFICATION_TYPE_BOUNTY_EXPIRES_IN_THREE_DAYS, self::NOTIFICATION_TYPE_BOUNTY_PERIOD_STARTED, self::NOTIFICATION_TYPE_EDIT_SUGGESTED, self::NOTIFICATION_TYPE_GENERIC, self::NOTIFICATION_TYPE_MODERATOR_MESSAGE, self::NOTIFICATION_TYPE_NEW_PRIVILEGE, self::NOTIFICATION_TYPE_POST_MIGRATED, self::NOTIFICATION_TYPE_PROFILE_ACTIVITY, self::NOTIFICATION_TYPE_REGISTRATION_REMINDER, self::NOTIFICATION_TYPE_REPUTATION_BONUS, self::NOTIFICATION_TYPE_SUBSTANTIVE_EDIT]);
     $this->postId = Util::setIfIntegerExists($json, 'post_id');
     $this->site = new Site(Util::setIfArrayExists($json, 'site'));
 }
 /**
  * Loads the variables if the data exist into resource. It works like a constructor.
  *
  * @param null|mixed[] $resource The resource
  */
 protected function loadAwardedBounty($resource)
 {
     $this->awardedBountyAmount = Util::setIfIntegerExists($resource, 'awarded_bounty_amount');
     $awardedBountyUsers = Util::setIfArrayExists($resource, 'awarded_bounty_users');
     foreach ($awardedBountyUsers as $awardedBountyUser) {
         $this->awardedBountyUsers[] = new ShallowUser($awardedBountyUser);
     }
 }
 /**
  * Loads the variables if the data exist into resource. It works like a constructor.
  *
  * @param null|mixed[] $resource The resource
  */
 protected function loadTop($resource)
 {
     $topAnswers = Util::setIfArrayExists($resource, 'top_answers');
     foreach ($topAnswers as $topAnswer) {
         $this->topAnswers[] = new NetworkPost($topAnswer);
     }
     $topQuestions = Util::setIfArrayExists($resource, 'top_questions');
     foreach ($topQuestions as $topQuestion) {
         $this->topQuestions[] = new NetworkPost($topQuestion);
     }
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->creationDate = Util::setIfDateTimeExists($json, 'creation_date');
     $this->tags = Util::setIfArrayExists($json, 'tags');
     $this->title = Util::setIfStringExists($json, 'title');
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->loadVoteCount($json);
     $this->commentId = Util::setIfIntegerExists($json, 'comment_id');
     $this->creationDate = Util::setIfDateTimeExists($json, 'creation_date');
     $this->owner = new ShallowUser(Util::setIfArrayExists($json, 'owner'));
     $this->postId = Util::setIfIntegerExists($json, 'post_id');
     $this->questionId = Util::setIfIntegerExists($json, 'question_id');
     $this->revisionGuid = Util::setIfStringExists($json, 'revision_guid');
     $this->timelineType = Util::isEqual($json, 'timeline_type', [self::TIMELINE_TYPE_ACCEPTED_ANSWER, self::TIMELINE_TYPE_ANSWER, self::TIMELINE_TYPE_COMMENT, self::TIMELINE_TYPE_POST_STATE_CHANGED, self::TIMELINE_TYPE_QUESTION, self::TIMELINE_TYPE_REVISION, self::TIMELINE_TYPE_UNACCEPTED_ANSWER, self::TIMELINE_TYPE_VOTE_AGGREGATE]);
     $this->user = new ShallowUser(Util::setIfArrayExists($json, 'user'));
 }
 /**
  * Loads the variables if the data exist into resource. It works like a constructor.
  *
  * @param null|mixed[] $resource The resource
  */
 protected function loadLast($resource)
 {
     $this->lastBody = Util::setIfStringExists($resource, 'last_body');
     $this->lastTags = Util::setIfArrayExists($resource, 'last_tags');
     $this->lastTitle = Util::setIfStringExists($resource, 'last_title');
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->onDate = Util::setIfDateTimeExists($json, 'on_date');
     $this->otherSite = new Site(Util::setIfArrayExists($json, 'other_site'));
     $this->questionId = Util::setIfIntegerExists($json, 'question_id');
 }
 /**
  * Loads the variables if the data exist into resource. It works like a constructor.
  *
  * @param null|mixed[] $resource The resource
  */
 protected function loadClose($resource)
 {
     $this->canClose = Util::setIfBoolExists($resource, 'can_close');
     $this->closeVoteCount = Util::setIfIntegerExists($resource, 'close_vote_count');
     $this->closedDate = Util::setIfDateTimeExists($resource, 'closed_date');
     $this->closedDetails = new ClosedDetails(Util::setIfArrayExists($resource, 'closed_details'));
     $this->closedReason = Util::setIfStringExists($resource, 'closed_reason');
 }