Ejemplo n.º 1
0
 /**
  * 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)
 {
     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');
 }