71 lines
1.4 KiB
PHP
71 lines
1.4 KiB
PHP
<?php
|
|
namespace ContentNation\ActivityPub\Message;
|
|
|
|
class Create {
|
|
/**
|
|
* unique id
|
|
* @var string
|
|
*/
|
|
private $id = '';
|
|
|
|
/**
|
|
* actor
|
|
* @var string
|
|
*/
|
|
private $actor = '';
|
|
|
|
/**
|
|
* object to create
|
|
* @var \ContentNation\ActivityPub\Common\APObject
|
|
*/
|
|
private $object = null;
|
|
|
|
/**
|
|
* set id
|
|
* @param string $id new id
|
|
* @return Create current instance
|
|
*/
|
|
public function setID(string $id) : Create {
|
|
$this->id = $id;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* set actor
|
|
* @param string $actor new actor
|
|
* @return Create current instance
|
|
*/
|
|
public function setActor(string $actor) : Create {
|
|
$this->actor = $actor;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* set object to create
|
|
* @param \ContentNation\ActivityPub\Common\APObject $object object to create
|
|
* @return Create current instance
|
|
*/
|
|
public function setObject(\ContentNation\ActivityPub\Common\APObject $object) : Create {
|
|
$this->object = $object;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* convert internal state to php array
|
|
* @return array<string,mixed>
|
|
*/
|
|
public function toObject() {
|
|
$return = array(
|
|
'@context' => 'https://www.w3.org/ns/activitystreams',
|
|
'id' => $this->id,
|
|
'type' => 'Create',
|
|
'actor' => $this->actor,
|
|
);
|
|
if ($this->object !== null) {
|
|
$return['object'] = $this->object->toObject();
|
|
}
|
|
return $return;
|
|
}
|
|
|
|
}
|