First implementation of ActivityPub C2S

This commit is contained in:
Michael 2023-01-29 14:41:14 +00:00
parent df021b07e3
commit 101b3c9703
7 changed files with 295 additions and 55 deletions

View file

@ -38,6 +38,8 @@ class Token extends BaseDataTransferObject
protected $scope;
/** @var int (timestamp) */
protected $created_at;
/** @var string */
protected $me;
/**
* Creates a token record
@ -46,12 +48,30 @@ class Token extends BaseDataTransferObject
* @param string $token_type
* @param string $scope
* @param string $created_at
* @param string $me
*/
public function __construct(string $access_token, string $token_type, string $scope, string $created_at)
public function __construct(string $access_token, string $token_type, string $scope, string $created_at, string $me = null)
{
$this->access_token = $access_token;
$this->token_type = $token_type;
$this->scope = $scope;
$this->created_at = strtotime($created_at);
$this->me = $me;
}
/**
* Returns the current entity as an array
*
* @return array
*/
public function toArray(): array
{
$token = parent::toArray();
if (empty($token['me'])) {
unset($token['me']);
}
return $token;
}
}