| @@ 52-61 (lines=10) @@ | ||
| 49 | */ |
|
| 50 | private $timer; |
|
| 51 | ||
| 52 | public static function create(LoopInterface $loop, string $token, float $timeout = 5): self |
|
| 53 | { |
|
| 54 | $resolverFactory = new ResolverFactory(); |
|
| 55 | $resolver = $resolverFactory->create('8.8.8.8', $loop); |
|
| 56 | ||
| 57 | $factory = new HttpClientFactory(); |
|
| 58 | $httpClient = $factory->create($loop, $resolver); |
|
| 59 | ||
| 60 | return new self($loop, $httpClient, $token, $timeout); |
|
| 61 | } |
|
| 62 | ||
| 63 | public static function createFromHttpClient( |
|
| 64 | LoopInterface $loop, |
|
| @@ 22-31 (lines=10) @@ | ||
| 19 | */ |
|
| 20 | private $token; |
|
| 21 | ||
| 22 | public static function create(LoopInterface $loop, string $token): self |
|
| 23 | { |
|
| 24 | $resolverFactory = new ResolverFactory(); |
|
| 25 | $resolver = $resolverFactory->create('8.8.8.8', $loop); |
|
| 26 | ||
| 27 | $factory = new HttpClientFactory(); |
|
| 28 | $httpClient = $factory->create($loop, $resolver); |
|
| 29 | ||
| 30 | return new self($httpClient, $token); |
|
| 31 | } |
|
| 32 | ||
| 33 | public static function createFromHttpClient(Client $httpClient, string $token): self |
|
| 34 | { |
|