1 | <?php |
||
17 | class PersonalAccessTokenFactory |
||
18 | { |
||
19 | /** |
||
20 | * The authorization server instance. |
||
21 | * |
||
22 | * @var \League\OAuth2\Server\AuthorizationServer |
||
23 | */ |
||
24 | protected $server; |
||
25 | |||
26 | /** |
||
27 | * The JWT token parser instance. |
||
28 | * |
||
29 | * @var \Lcobucci\JWT\Parser |
||
30 | */ |
||
31 | protected $jwt; |
||
32 | |||
33 | /** |
||
34 | * Create a new personal access token factory instance. |
||
35 | * |
||
36 | * @param \League\OAuth2\Server\AuthorizationServer $server |
||
37 | * @param \Lcobucci\JWT\Parser $jwt |
||
38 | * |
||
39 | * @return void |
||
|
|||
40 | */ |
||
41 | public function __construct(AuthorizationServer $server, JwtParser $jwt) |
||
46 | |||
47 | /** |
||
48 | * Create a new personal access token. |
||
49 | * |
||
50 | * @param \Illuminate\Database\Eloquent\Model $user |
||
51 | * @param string $name |
||
52 | * @param array $scopes |
||
53 | * |
||
54 | * @return \Rinvex\Oauth\PersonalAccessTokenResult |
||
55 | */ |
||
56 | public function make(Model $user, $name, array $scopes = []) |
||
75 | |||
76 | /** |
||
77 | * Get the personal access token client for the application. |
||
78 | * |
||
79 | * @throws \RuntimeException |
||
80 | * |
||
81 | * @return \Rinvex\Oauth\Models\Client |
||
82 | */ |
||
83 | public function personalAccessClient() |
||
97 | |||
98 | /** |
||
99 | * Create a request instance for the given client. |
||
100 | * |
||
101 | * @param \Rinvex\Oauth\Models\Client $client |
||
102 | * @param \Illuminate\Database\Eloquent\Model $user |
||
103 | * @param array $scopes |
||
104 | * |
||
105 | * @return \Psr\Http\Message\ServerRequestInterface |
||
106 | */ |
||
107 | protected function createRequest(Client $client, Model $user, array $scopes) |
||
119 | |||
120 | /** |
||
121 | * Dispatch the given request to the authorization server. |
||
122 | * |
||
123 | * @param \Psr\Http\Message\ServerRequestInterface $request |
||
124 | * |
||
125 | * @throws \League\OAuth2\Server\Exception\OAuthServerException |
||
126 | * |
||
127 | * @return array |
||
128 | */ |
||
129 | protected function dispatchRequestToAuthorizationServer(ServerRequestInterface $request) |
||
136 | |||
137 | /** |
||
138 | * Get the access token instance for the parsed response. |
||
139 | * |
||
140 | * @param array $response |
||
141 | * |
||
142 | * @return \Rinvex\Oauth\Models\AccessToken |
||
143 | */ |
||
144 | protected function findAccessToken(array $response) |
||
148 | } |
||
149 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.