コード例 #1
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'));
 }
コード例 #2
0
 /**
  * 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');
 }