36 lines
817 B
PHP
36 lines
817 B
PHP
<?php
|
|
namespace ContentNation\ActivityPub\Common;
|
|
require_once("IntransitiveActivity.php");
|
|
class Question extends IntransitiveActivity {
|
|
/**
|
|
* voters count
|
|
* @var int
|
|
*/
|
|
private $votersCount = 0;
|
|
|
|
// oneOf | anyOf | closed
|
|
public function __construct() {
|
|
parent::__construct("Question");
|
|
}
|
|
/**
|
|
* convert internal state to php array
|
|
* @return array<string,mixed>
|
|
*/
|
|
public function toObject() {
|
|
$return = parent::toObject();
|
|
$return['votersCount'] = $this->votersCount;
|
|
return $return;
|
|
}
|
|
|
|
/**
|
|
* create object from json
|
|
* @param mixed $json input json
|
|
*/
|
|
public function fromJson($json) : bool {
|
|
if (array_key_exists('votersCount', $json)) {
|
|
$this->votersCount = intval($json['votersCount'], 10);
|
|
}
|
|
return parent::fromJson($json);
|
|
}
|
|
}
|