-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconcept.php
More file actions
54 lines (45 loc) · 1.23 KB
/
concept.php
File metadata and controls
54 lines (45 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
interface SecretKeyStorageInterface
{
public function getSecretKey():string;
}
class SecretKeyFileStorage implements SecretKeyStorageInterface
{
public function getSecretKey():string
{
return 'SecretKeyFileStorage KEY';
}
}
class SecretKeyDBStorage implements SecretKeyStorageInterface
{
public function getSecretKey():string
{
return 'SecretKeyDB KEY';
}
}
class SecretKeyCloudStorage implements SecretKeyStorageInterface
{
public function getSecretKey():string
{
return 'SecretKeyCloud KEY';
}
}
class Concept {
private $client;
private $secretKeyStorage;
public function __construct(SecretKeyStorageInterface $secretKeyStorage, \GuzzleHttp\Client $client) {
$this->secretKeyStorage = $secretKeyStorage;
$this->client = $client;
}
public function getUserData() {
$params = [
'auth' => ['user', 'pass'],
'token' => $this->secretKeyStorage->getSecretKey()
];
$request = new \Request('GET', 'https://api.method', $params);
$promise = $this->client->sendAsync($request)->then(function ($response) {
$result = $response->getBody();
});
$promise->wait();
}
}