1 | <?php |
||
16 | trait GrantsTrait |
||
17 | { |
||
18 | /** |
||
19 | * @param AuthorizationServer $server |
||
20 | */ |
||
21 | 2 | public function registerGrants(AuthorizationServer $server) |
|
29 | |||
30 | /** |
||
31 | * @return mixed|\Nip\Config\Config |
||
32 | */ |
||
33 | 1 | protected function getRegisteredGrants() |
|
37 | |||
38 | /** |
||
39 | * @param AuthorizationServer $server |
||
40 | * @param string $class |
||
41 | */ |
||
42 | protected function makeGrantPersonalAccess(AuthorizationServer $server, string $class) |
||
51 | |||
52 | /** |
||
53 | * @param AuthorizationServer $server |
||
54 | * @param string $class |
||
55 | */ |
||
56 | protected function makeGrantAuthCode(AuthorizationServer $server, string $class) |
||
68 | |||
69 | /** |
||
70 | * @param AuthorizationServer $server |
||
71 | * @param string $class |
||
72 | */ |
||
73 | protected function makeGrantRefreshToken(AuthorizationServer $server, string $class) |
||
79 | |||
80 | /** |
||
81 | * @param AuthorizationServer $server |
||
82 | * @param string $class |
||
83 | */ |
||
84 | protected function makeGrantPassword(AuthorizationServer $server, string $class) |
||
91 | |||
92 | /** |
||
93 | * @param AuthorizationServer $server |
||
94 | * @param string $class |
||
95 | */ |
||
96 | protected function makeGrantImplicit(AuthorizationServer $server, string $class) |
||
102 | |||
103 | /** |
||
104 | * @param AuthorizationServer $server |
||
105 | * @param string $class |
||
106 | */ |
||
107 | protected function makeGrantClientCredentials(AuthorizationServer $server, string $class) |
||
111 | |||
112 | /** |
||
113 | * @param AuthorizationServer $server |
||
114 | * @param string|null $type |
||
115 | * @param array $args |
||
116 | */ |
||
117 | protected function makeGrant(AuthorizationServer $server, string $type, array $args, $accessTokenTTL = null) |
||
126 | } |
||
127 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.