1 | <?php |
||
14 | class Mati |
||
15 | { |
||
16 | /** |
||
17 | * Mati API client |
||
18 | * |
||
19 | * @var MatiClientInterface |
||
20 | */ |
||
21 | protected $client; |
||
22 | protected $client_id = null; |
||
23 | protected $client_secret = null; |
||
24 | |||
25 | /** |
||
26 | * Mati class constructor |
||
27 | * |
||
28 | * @param MatiClientInterface $client |
||
29 | * @param string|null $client_id |
||
30 | * @param string|null $client_secret |
||
31 | */ |
||
32 | public function __construct( |
||
45 | |||
46 | /** |
||
47 | * Set Client ID for authorization |
||
48 | * |
||
49 | * @param string $client_id |
||
50 | * @return self |
||
51 | */ |
||
52 | public function setClientId(string $client_id) |
||
58 | |||
59 | /** |
||
60 | * Set Client Secret for authorization |
||
61 | * |
||
62 | * @param string $client_secret |
||
63 | * @return self |
||
64 | */ |
||
65 | public function setClientSecret(string $client_secret) |
||
71 | |||
72 | /** |
||
73 | * Set API access token |
||
74 | * |
||
75 | * Good to use with caching for JWT token |
||
76 | * |
||
77 | * @param string $access_token |
||
78 | * @return self |
||
79 | */ |
||
80 | public function setAccessToken(string $access_token) |
||
86 | |||
87 | /** |
||
88 | * Authorize with Mati's API credentials |
||
89 | * |
||
90 | * @param string|null $client_id |
||
91 | * @param string|null $client_secret |
||
92 | * @return self |
||
93 | */ |
||
94 | public function authorize(string $client_id = null, string $client_secret = null) |
||
114 | |||
115 | /** |
||
116 | * Alias for authorize() |
||
117 | * |
||
118 | * @see authorize() |
||
119 | */ |
||
120 | public function authorise(...$args) |
||
124 | |||
125 | /** |
||
126 | * Create a new verification process |
||
127 | * |
||
128 | * @return object |
||
129 | */ |
||
130 | public function createVerification( |
||
138 | |||
139 | /** |
||
140 | * Send input for verification |
||
141 | * |
||
142 | * @param string $identity_id |
||
143 | * @param IdentityInputInterface[]|Collection $inputs |
||
144 | * @return object |
||
145 | */ |
||
146 | public function sendInput(string $identity_id, $inputs) |
||
150 | |||
151 | /** |
||
152 | * Retrieve info about a verification process |
||
153 | * |
||
154 | * @param string $resource_url URL received by webhook |
||
155 | * @return object |
||
156 | */ |
||
157 | public function retrieveResourceDataFromUrl(string $resource_url) |
||
161 | |||
162 | /** |
||
163 | * Retrieve info about a verification process |
||
164 | * |
||
165 | * @param string $verification_id |
||
166 | * @return object |
||
167 | */ |
||
168 | public function retrieveResourceDataByVerificationId(string $verification_id) |
||
172 | |||
173 | /** |
||
174 | * Download the file sent by the user during the verification process |
||
175 | * |
||
176 | * @param string $media_url |
||
177 | * |
||
178 | * @throws RequestException |
||
179 | * @return string Media contents |
||
180 | */ |
||
181 | public function downloadVerificationMedia(string $media_url) |
||
185 | |||
186 | /** |
||
187 | * Resolve value for Client ID in the constructor |
||
188 | * |
||
189 | * @param string|null $client_id |
||
190 | * @return void |
||
191 | */ |
||
192 | protected function resolveClientId($client_id) |
||
203 | |||
204 | /** |
||
205 | * Resolve value for Client Secret in the constructor |
||
206 | * |
||
207 | * @param string|null $client_secret |
||
208 | * @return void |
||
209 | */ |
||
210 | protected function resolveClientSecret($client_secret) |
||
221 | } |
||
222 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: