/** * 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')); }
/** * Constructor. * * @param null|mixed[] $json The json string being decoded */ public function __construct($json = null) { parent::__construct($json); $this->id = Util::setIfIntegerExists($json, 'answer_id'); $this->loadAwardedBounty($json); $this->privateAccepted = Util::setIfBoolExists($json, 'accepted'); $this->canFlag = Util::setIfBoolExists($json, 'can_flag'); $this->isAccepted = Util::setIfBoolExists($json, 'is_accepted'); $this->questionId = Util::setIfIntegerExists($json, 'question_id'); }
/** * 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, 'user_id'); $this->canAdd = Util::setIfBoolExists($json, 'can_add'); $this->canDelete = Util::setIfBoolExists($json, 'can_delete'); $this->canEdit = Util::setIfBoolExists($json, 'can_edit'); $this->maxDailyActions = Util::setIfIntegerExists($json, 'max_daily_actions'); $this->minSecondsBetweenActions = Util::setIfIntegerExists($json, 'min_seconds_between_actions'); $this->objectType = Util::setIfStringExists($json, 'object_type'); }
/** * 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->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->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) { parent::__construct($json); $this->loadCommentCount($json); $this->loadEdit($json); $this->loadVoteCount($json); $this->downvoted = Util::setIfBoolExists($json, 'downvoted'); $this->lastActivityDate = Util::setIfDateTimeExists($json, 'last_activity_date'); $this->link = Util::setIfStringExists($json, 'link'); $this->shareLink = Util::setIfStringExists($json, 'share_link'); $this->title = Util::setIfStringExists($json, 'title'); }
/** * 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'); }
/** * 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'); }
/** * Loads the variables if the data exist into resource. It works like a constructor. * * @param null|mixed[] $resource The resource */ protected function loadAnswered($resource) { $this->requiresComment = Util::setIfBoolExists($resource, 'requires_comment'); $this->requiresQuestionId = Util::setIfBoolExists($resource, 'requires_question_id'); $this->requiresSite = Util::setIfBoolExists($resource, 'requires_site'); }
/** * 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'); }
/** * Loads the variables if the data exist into resource. It works like a constructor. * * @param null|mixed[] $resource The resource */ protected function loadFavorite($resource) { $this->favoriteCount = Util::setIfIntegerExists($resource, 'favorite_count'); $this->favorited = Util::setIfBoolExists($resource, 'favorited'); }
/** * 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'); }
/** * 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')); }
/** * Constructor. * * @param null|mixed[] $json The json string being decoded */ public function __construct($json = null) { parent::__construct($json); $this->loadReputationChange($json); $this->loadVoteCount($json); $this->aboutMe = Util::setIfStringExists($json, 'about_me'); $this->accountId = Util::setIfIntegerExists($json, 'account_id'); $this->age = Util::setIfIntegerExists($json, 'age'); $this->answerCount = Util::setIfIntegerExists($json, 'answer_count'); $this->creationDate = Util::setIfDateTimeExists($json, 'creation_date'); $this->isEmployee = Util::setIfBoolExists($json, 'is_employee'); $this->lastAccessDate = Util::setIfDateTimeExists($json, 'last_access_date'); $this->lastModifiedDate = Util::setIfDateTimeExists($json, 'last_modified_date'); $this->location = Util::setIfStringExists($json, 'location'); $this->questionCount = Util::setIfIntegerExists($json, 'question_count'); $this->timedPenaltyDate = Util::setIfDateTimeExists($json, 'timed_penalty_date'); $this->viewCount = Util::setIfIntegerExists($json, 'view_count'); $this->websiteUrl = Util::setIfStringExists($json, 'website_url'); }
/** * Loads the variables if the data exist into resource. It works like a constructor. * * @param null|mixed[] $resource The resource */ protected function loadAnswered($resource) { $this->isAnswered = Util::setIfBoolExists($resource, 'is_answered'); }