Exemplo 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, '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');
 }
Exemplo n.º 2
0
 /**
  * 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');
 }