mirror of
https://github.com/friendica/friendica
synced 2025-04-24 23:10:11 +00:00
First implementation of ActivityPub C2S
This commit is contained in:
parent
df021b07e3
commit
101b3c9703
7 changed files with 295 additions and 55 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue