setServer($server); $this->actor = $actor; } /** * Server instance setter * * @param \ActivityPhp\Server $server */ public function setServer(Server $server) { $this->server = $server; } /** * Server instance getter * * @return \ActivityPhp\Server */ public function getServer() { return $this->server; } /** * Configuration shortcut * * @param string $param * @return mixed A configuration parameter or an instance of * \ActivityPhp\Server\Configuration\AbstractConfiguration */ public function config(string $param) { return $this->getServer()->config($param); } /** * Wrap an object into a Create activity * * @see https://www.w3.org/TR/activitypub/#object-without-create * * @param \ActivityPhp\Type\AbstractObject $object * @return \ActivityPhp\Type\Core\AbstractActivity */ protected function wrapObject(AbstractObject $object) { $activity = Type::create('Create', [ '@context' => $object->get('@context'), 'actor' => $this->actorUrl(), 'published' => isset($object->published) ? $object->published : date('Y-m-dTH:i:sZ'), ]); if (isset($object->to)) { $activity->to = $object->to; } if (isset($object->cc)) { $activity->cc = $object->cc; } // @see https://www.w3.org/TR/activitypub/#create-activity-outbox // Set attributedTo property $copy = $object->copy() ->set('@context', null) ->set('attributedTo', $activity->actor); // Create a local id for object // @todo A copy of this object should be created $copy->id = $this->config('instance.scheme') . '://' . $this->config('instance.host') . preg_replace( ['//', '//'], [$this->actor->get()->preferredUsername, 'new-id'], $this->config('instance.notePath') ); // Create an id for activity // @todo An id must be generated for the activity $activity->id = $this->config('instance.scheme') . '://' . $this->config('instance.host') . preg_replace( ['//', '//'], [$this->actor->get()->preferredUsername, 'new-id'], $this->config('instance.activityPath') ); // Attach as an object property $activity->object = $copy->toArray(); return $activity; } /** * Get actor id * * @todo Handle non local actors * @return string */ protected function actorUrl() { return $this->config('instance.scheme') . '://' . $this->config('instance.host') . preg_replace( ['//'], [$this->actor->get()->preferredUsername], $this->config('instance.actorPath') ); } } __halt_compiler();----SIGNATURE:----pyzE+W74GqXs4rdUX5Wyj8N0CcCL2VaQVQSF1gmyEsYc5Vfar0N3SSpA7vaHy/Fx3CGS9e485FmK404JHgS0By9FHZGJv1VCsEoex/puRiNbCB3d5bWbMoXrvP2inLBKCHkBwg0MvGhBCUpXMHJNMY4AAVEWl323089fA1YIKS8OnuIyN87b9qPCSDdF7woq7Y2p/AsG8FtC4bI5ijSyVFUZJttjzFC6mRci2SPnkoUMMTVbtiNFg1skzVspbdqAYH3bwpIDSy7fw0+f8amuDilFQ9fKBHt498g7UclztgoKLTAFFQyrUE7Dgl+cavU7V/eEY5Xy6AlKuByLtESVGTPJJMXcUIhO8YFz1N5Rn0Bbha1LIJ7sYwfQvQ/7nfmmZ+Tv2y9RvcVj757Lz1s2NBCNGWgT+tFgllEPTsFG37895T9yfB5iUNGs5VSYFvZsPuxl8Ra1svgQZ/GfXiqNF+6n2MDiuTH9Pv5rQpKT4DFmL9iQ9aLUWdbE8cAn/T/YKN8fXsV1/6yO3keFkVkHxp6Cw+wAwSoXwnLyxghUJvMsGDMKWJBbNoSMykwSeZNH0hif9wkWVHldazgqgqFH9qgdklUOKpc8TvRkhz2xCHuonLD0x+qGvx/KN6+FP0l/d/LnJM3fd0gGjWDBQRd2n30tgCoZoBQkR3UoBfm0XX8=----ATTACHMENT:----NTU0OTE3OTU4MDg5NzI5NCAzNDY3MTUxMDA0NjUwMTc0IDg4NjUxNTY0MjU5OTAwMzQ=