/**
  * 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)
 {
     $this->apiSiteParameter = Util::setIfStringExists($json, 'api_site_parameter');
     $this->name = Util::setIfStringExists($json, 'name');
     $this->relation = Util::isEqual($json, 'relation', [self::RELATION_CHAT, self::RELATION_META, self::RELATION_PARENT]);
     $this->siteUrl = Util::setIfStringExists($json, 'site_url');
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->id = Util::setIfIntegerExists($json, 'post_id');
     $this->postType = Util::isEqual($json, 'post_type', [self::POST_TYPE_ANSWER, self::POST_TYPE_QUESTION]);
     $this->score = Util::setIfIntegerExists($json, 'score');
     $this->title = Util::setIfStringExists($json, 'title');
 }
Exemplo n.º 4
0
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->id = Util::setIfIntegerExists($json, 'event_id');
     $this->creationDate = Util::setIfDateTimeExists($json, 'creation_date');
     $this->eventType = Util::isEqual($json, 'event_type', [self::EVENT_TYPE_ANSWER_POSTED, self::EVENT_TYPE_COMMENT_POSTED, self::EVENT_TYPE_POST_EDITED, self::EVENT_TYPE_QUESTION_POSTED, self::EVENT_TYPE_USER_CREATED]);
     $this->excerpt = Util::setIfStringExists($json, 'excerpt');
     $this->link = Util::setIfStringExists($json, 'link');
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->appliedCount = Util::setIfIntegerExists($json, 'applied_count');
     $this->creationDate = Util::setIfDateTimeExists($json, 'creation_date');
     $this->fromTag = Util::setIfStringExists($json, 'from_tag');
     $this->lastAppliedDate = Util::setIfDateTimeExists($json, 'last_applied_date');
     $this->toTag = Util::setIfStringExists($json, 'to_tag');
 }
 /**
  * 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'));
 }
Exemplo n.º 7
0
 /**
  * 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'));
 }
Exemplo n.º 8
0
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->answerCount = Util::setIfIntegerExists($json, 'answer_count');
     $this->answerScore = Util::setIfIntegerExists($json, 'answer_score');
     $this->questionCount = Util::setIfIntegerExists($json, 'question_count');
     $this->questionScore = Util::setIfIntegerExists($json, 'question_score');
     $this->tagName = Util::setIfStringExists($json, 'tag_name');
     $this->userId = Util::setIfIntegerExists($json, 'user_id');
 }
 /**
  * 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');
 }
Exemplo n.º 10
0
 /**
  * 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');
 }
Exemplo n.º 11
0
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     if (isset($json['description']) === true) {
         $this->description = Util::setIfStringExists($json, 'description');
     } else {
         $this->description = Util::setIfStringExists($json, 'error_message');
     }
     $this->code = Util::setIfIntegerExists($json, 'error_id');
     $this->message = Util::setIfStringExists($json, 'error_name');
 }
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->accountId = Util::setIfIntegerExists($json, 'account_id');
     $this->activityType = Util::isEqual($json, 'activity_type', [self::ACTIVITY_TYPE_ANSWER_POSTED, self::ACTIVITY_TYPE_BADGE_EARNED, self::ACTIVITY_TYPE_COMMENT_POSTED, self::ACTIVITY_TYPE_QUESTION_POSTED]);
     $this->apiSiteParameter = Util::setIfStringExists($json, 'api_site_parameter');
     $this->description = Util::setIfStringExists($json, 'description');
     $this->link = Util::setIfStringExists($json, 'link');
     $this->postId = Util::setIfIntegerExists($json, 'post_id');
     $this->score = Util::setIfIntegerExists($json, 'score');
 }
 /**
  * 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');
 }
Exemplo n.º 14
0
 /**
  * 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->approvalDate = Util::setIfDateTimeExists($json, 'approval_date');
     $this->body = Util::setIfStringExists($json, 'body');
     $this->comment = Util::setIfStringExists($json, 'comment');
     $this->postId = Util::setIfIntegerExists($json, 'post_id');
     $this->postType = Util::isEqual($json, 'post_type', [self::POST_TYPE_QUESTION, self::POST_TYPE_ANSWER]);
     $this->proposingUser = new ShallowUser(Util::setIfArrayExists($json, 'proposing_user'));
     $this->rejectionDate = Util::setIfDateTimeExists($json, 'rejection_date');
     $this->suggestedEditId = new ShallowUser(Util::setIfArrayExists($json, 'suggested_edit_id'));
 }
 /**
  * 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]);
 }
Exemplo n.º 17
0
 /**
  * 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)
 {
     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');
 }
Exemplo n.º 19
0
 /**
  * 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');
 }
Exemplo n.º 20
0
 /**
  * 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)
 {
     $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 loadGenericId($resource)
 {
     $this->answerId = Util::setIfIntegerExists($resource, 'answer_id');
     $this->body = Util::setIfStringExists($resource, 'body');
     $this->questionId = Util::setIfIntegerExists($resource, 'question_id');
 }
Exemplo n.º 23
0
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->link = Util::setIfStringExists($json, 'link');
     $this->onDate = Util::setIfDateTimeExists($json, 'on_date');
     $this->postId = Util::setIfIntegerExists($json, 'post_id');
     $this->postType = Util::isEqual($json, 'post_type', [self::POST_TYPE_ANSWER, self::POST_TYPE_QUESTION]);
     $this->reputationChange = Util::setIfIntegerExists($json, 'reputation_change');
     $this->title = Util::setIfStringExists($json, 'title');
     $this->userId = Util::setIfIntegerExists($json, 'user_id');
     $this->voteType = Util::isEqual($json, 'vote_type', [self::VOTE_TYPE_ACCEPTS, self::VOTE_TYPE_BOUNTIES_OFFERED, self::VOTE_TYPE_BOUNTIES_WON, self::VOTE_TYPE_DOWN_VOTES, self::VOTE_TYPE_SPAM, self::VOTE_TYPE_SUGGESTED_EDITS, self::VOTE_TYPE_UP_VOTES]);
 }
Exemplo n.º 24
0
 /**
  * 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)
 {
     $this->id = Util::setIfIntegerExists($json, 'user_id');
     $this->loadCount($json);
     $this->loadTop($json);
     $this->accountId = Util::setIfIntegerExists($json, 'account_id');
     $this->creationDate = Util::setIfDateTimeExists($json, 'creation_date');
     $this->lastAccessDate = Util::setIfDateTimeExists($json, 'last_access_date');
     $this->reputation = Util::setIfIntegerExists($json, 'reputation');
     $this->siteName = Util::setIfStringExists($json, 'site_name');
     $this->siteUrl = Util::setIfStringExists($json, 'site_url');
     $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]);
 }
Exemplo n.º 26
0
 /**
  * Constructor.
  *
  * @param null|mixed[] $json The json string being decoded
  */
 public function __construct($json = null)
 {
     $this->linkColor = Util::setIfStringExists($json, 'link_color');
     $this->tagForegroundColor = Util::setIfStringExists($json, 'tag_foreground_color');
     $this->tagBackgroundColor = Util::setIfStringExists($json, 'tag_background_color');
 }
 /**
  * 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)
 {
     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');
 }
Exemplo n.º 29
0
 /**
  * Loads the variables if the data exist into resource. It works like a constructor.
  *
  * @param null|mixed[] $resource The resource
  */
 protected function loadUrl($resource)
 {
     $this->faviconUrl = Util::setIfStringExists($resource, 'favicon_url');
     $this->highResIconUrl = Util::setIfStringExists($resource, 'high_resolution_icon_url');
     $this->iconUrl = Util::setIfStringExists($resource, 'icon_url');
     $this->logoUrl = Util::setIfStringExists($resource, 'logo_url');
 }
 /**
  * Loads the variables if the data exist into resource. It works like a constructor.
  *
  * @param null|mixed[] $resource  The resource
  * @param string[]     $constants The array of constants
  */
 protected function loadRevision($resource, $constants)
 {
     $this->revisionGuid = Util::setIfStringExists($resource, 'revision_guid');
     $this->revisionNumber = Util::setIfIntegerExists($resource, 'revision_number');
     $this->revisionType = Util::isEqual($resource, 'revision_type', $constants);
 }