44 lines
952 B
PHP
44 lines
952 B
PHP
<?php
|
|
namespace ContentNation\ActivityPub\Common;
|
|
|
|
require_once("Activity.php");
|
|
|
|
class Announce extends Activity {
|
|
/**
|
|
* object overwrite
|
|
* @var string
|
|
*/
|
|
private $object = "";
|
|
|
|
public function setAObject(string $object) : void {
|
|
$this->object = $object;
|
|
}
|
|
|
|
public function getAObject() : string {
|
|
return $this->object;
|
|
}
|
|
|
|
public function __construct() {
|
|
parent::__construct('Announce');
|
|
parent::addContext('https://www.w3.org/ns/activitystreams');
|
|
}
|
|
public function fromJson($json) : bool {
|
|
if (array_key_exists('object', $json)) {
|
|
$this->object = $json['object'];
|
|
unset($json['object']);
|
|
}
|
|
return parent::fromJson($json);
|
|
}
|
|
/**
|
|
* convert internal state to php array
|
|
* @return array<string,mixed>
|
|
*/
|
|
public function toObject() {
|
|
$return = parent::toObject();
|
|
if ($this->object !== "") {
|
|
$return['object'] = $this->object;
|
|
}
|
|
return $return;
|
|
}
|
|
|
|
} |