First implementation of ActivityPub C2S
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user