activitypub/src/ContentNation/ActivityPub/Common/Follow.php

38 lines
809 B
PHP

<?php
namespace ContentNation\ActivityPub\Common;
require_once("Activity.php");
class Follow extends Activity {
/**
* object overwrite
* @var string
*/
private $object = "";
public function setFObject(string $object) : void {
$this->object = $object;
}
public function __construct() {
parent::__construct("Follow");
}
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;
}
}