/** * {@inheritdoc} */ public function setEventType($eventType) { if (Util::coincidesElement($eventType, [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]) === true) { $this->eventType = $eventType; } return $this; }
/** * {@inheritdoc} */ public function setPostType($postType) { if (Util::coincidesElement($postType, [self::POST_TYPE_ANSWER, self::POST_TYPE_QUESTION]) === true) { $this->postType = $postType; } return $this; }
/** * 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->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->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) { $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) { 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) { 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) { 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'); }
/** * {@inheritdoc} */ public function removeSynonym($synonym) { $this->synonyms = Util::removeElement($synonym, $this->synonyms); return $this; }
/** * 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'); }
/** * {@inheritdoc} */ public function setVoteType($voteType) { if (Util::coincidesElement($voteType, [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]) === true) { $this->voteType = $voteType; } return $this; }
/** * {@inheritdoc} */ public function setUserType($userType) { if (Util::coincidesElement($userType, [self::USER_TYPE_DOES_NOT_EXIST, self::USER_TYPE_MODERATOR, self::USER_TYPE_REGISTERED, self::USER_TYPE_UNREGISTERED]) === true) { $this->userType = $userType; } return $this; }
/** * {@inheritdoc} */ public function removeIncludedField($includedField) { $this->includedFields = Util::removeElement($includedField, $this->includedFields); return $this; }
/** * {@inheritdoc} */ public function setRelation($relation) { if (Util::coincidesElement($relation, [self::RELATION_CHAT, self::RELATION_META, self::RELATION_PARENT]) === true) { $this->relation = $relation; } return $this; }
/** * 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) { $this->onDate = Util::setIfDateTimeExists($json, 'on_date'); $this->otherSite = new Site(Util::setIfArrayExists($json, 'other_site')); $this->questionId = Util::setIfIntegerExists($json, 'question_id'); }
/** * Removes tag. * * @param string $tag The tag * * @return $this self Object */ public function removeTag($tag) { $this->tags = Util::removeElement($tag, $this->tags); return $this; }
/** * 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); } }
/** * 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 loadFavorite($resource) { $this->favoriteCount = Util::setIfIntegerExists($resource, 'favorite_count'); $this->favorited = Util::setIfBoolExists($resource, 'favorited'); }
/** * 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'); }
/** * {@inheritdoc} */ public function setReputationHistoryType($reputationHistoryType) { if (Util::coincidesElement($reputationHistoryType, $this->reputationHistoryTypes) === true) { $this->reputationHistoryType = $reputationHistoryType; } return $this; }
/** * Loads the variables if the data exist into resource. It works like a constructor. * * @param null|mixed[] $resource The resource */ protected function loadAnswer($resource) { $this->acceptedAnswerId = Util::setIfIntegerExists($resource, 'accepted_answer_id'); $this->answerCount = Util::setIfIntegerExists($resource, 'answer_count'); }
/** * {@inheritdoc} */ public function setItemType($itemType) { if (Util::coincidesElement($itemType, [self::ITEM_TYPE_ANSWER, self::ITEM_TYPE_QUESTION]) === true) { $this->itemType = $itemType; } return $this; }
/** * {@inheritdoc} */ public function removeOriginalQuestion(OriginalQuestionInterface $originalQuestion) { $this->originalQuestions = Util::removeElement($originalQuestion, $this->originalQuestions); return $this; }
/** * 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'); }
/** * {@inheritdoc} */ public function removeAnswer(AnswerInterface $answer) { $this->answers = Util::removeElement($answer, $this->answers); return $this; }