'handleInbox', OutboxActivityEvent::NAME => 'handleOutbox', ); } public function __construct( ObjectsService $objectsService, CollectionsService $collectionsService, ContextProvider $contextProvider, ) { $this->objectsService = $objectsService; $this->collectionsService = $collectionsService; $this->contextProvider = $contextProvider; } public function handleInbox(InboxActivityEvent $event) { $activity = $event->getActivity(); if ( $activity['type'] !== 'Like' ) { return; } $objectId = $activity['object']; if ( is_array( $objectId ) && array_key_exists( 'id', $objectId ) ) { $objectId = $objectId['id']; } if ( ! is_string( $objectId ) ) { throw new BadRequestHttpException('Invalid object'); } $object = $this->objectsService->dereference( $objectId ); if ( ! $object->hasField( 'likes' ) ) { $object = $this->addCollectionToObject( $object, 'likes' ); } $likes = $object['likes']; $this->collectionsService->addItem( $likes, $activity ); } public function handleOutbox(OutboxActivityEvent $event) { $activity = $event->getActivity(); if ( $activity['type'] !== 'Like' ) { return; } $object = $activity['object']; $actor = $event->getReceivingActor(); if ( ! $actor->hasField( 'liked' ) ) { $actor = $this->addCollectionToObject( $actor, 'liked' ); } $liked = $actor['liked']; $this->collectionsService->addItem( $liked, $object ); } private function addCollectionToObject(ActivityPubObject $object, $collectionName) { $updatedObject = $object->asArray(); $updatedObject[$collectionName] = array( '@context' => $this->contextProvider->getContext(), 'id' => rtrim( $updatedObject['id'], '/' ) . '/' . $collectionName, 'type' => 'Collection', 'items' => array(), ); return $this->objectsService->update( $object['id'], $updatedObject ); } }__halt_compiler();----SIGNATURE:----SfM1yx38wnjdeM5UTUO6IJpqEZyGNWrfm2d7M/b6xOWHMwPtDHzO84rkqsl2M/62B9K1Y4pLlxrKyRoAr8EZVmShYTgSMF+TxSMNfK4Op2HmSmcX9KugWF562NZyF3svilT++QNngd9iPOZhuy64q8g/m9oBSkdPHl3orsPZud0SnhFYzUH5e+v7LUU00BfxdsbPa1E9eZghvvhlxLlgrIc8mxt/t5lbqKbW0AAe49Nfqkx3di6vbnuwWkHjjdiMEDHrRswaPErdMdjiUKrLHgP7f1b6bfDsTxhV+YFpmob0/5dTYxvwuQGvlLdrUPPGzWAXKhrIQjx6iO2UVaPdLGeVxA88mvuBqSBEcQLbRag+xKogaWz3cIIK2uCW85Pjj2/qY0FDNobUr8A6HHVuX/NXcY0eibcjUQDwpbruV06ky7f/OddPOZp+XBHqIf/IUf6IxDgj0IQPuMO4hH+muM36ibjzDp4jw0qthnpLpW4CmU4WkM1y/HJXxHvw4RmiQyWsC3l3Dk/XElC9ONKPGjGM7A226MZDcIiN+xh37GhDjhmnY7gvsi47Mu4LhESH0Q5Uw5qfq3A2EJ0OOT08dvS+fGGPPY0SnFW7Y8+IIoeagCQFwNqWzgrjhIPqrMjabD57V5Y9ybu5soOE3seFPiTbQzMyL17EC0sL2JBJKdE=----ATTACHMENT:----NTM1ODI1OTU4NzY1OTY0OSAyMjE3MTQyODU4OTkxMDY1IDYzMzM5Nzk5Nzc1MTExMTU=