@@ -11,18 +11,18 @@ |
||
11 | 11 | |
12 | 12 | private $matches = null; |
13 | 13 | |
14 | - public function __construct(?string $data = '') |
|
14 | + public function __construct(? string $data = '') |
|
15 | 15 | { |
16 | 16 | $this->data = $data; |
17 | 17 | } |
18 | 18 | |
19 | - public function parse(?string $data = null) : int |
|
19 | + public function parse(? string $data = null) : int |
|
20 | 20 | { |
21 | 21 | if (!empty($data)) { |
22 | 22 | $this->data = $data; |
23 | 23 | } |
24 | 24 | |
25 | - $found = preg_match_all('/<esi:include [^>]*\\/>/ims', $this->data, $this->matches); |
|
25 | + $found = preg_match_all('/<esi:include [^>]*\\/>/ims', $this->data, $this->matches); |
|
26 | 26 | |
27 | 27 | return $found; |
28 | 28 | } |
@@ -21,11 +21,11 @@ |
||
21 | 21 | |
22 | 22 | public function validate(): bool |
23 | 23 | { |
24 | - if (array_key_exists('concurrency', $this->config) && (int)$this->config['concurrency'] < 1) { |
|
24 | + if (array_key_exists('concurrency', $this->config) && (int)$this->config['concurrency']<1) { |
|
25 | 25 | throw new InvalidOptionValueException('Concurrency must be greater than 0.'); |
26 | 26 | } |
27 | 27 | |
28 | - if (array_key_exists('timeout', $this->config) && (int)$this->config['timeout'] <=0 ) { |
|
28 | + if (array_key_exists('timeout', $this->config) && (int)$this->config['timeout']<=0) { |
|
29 | 29 | throw new InvalidOptionValueException('Timeout option must greater than 0.'); |
30 | 30 | } |
31 | 31 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | $recurrency = $this->options['recurecny_lever']; |
51 | 51 | |
52 | - while ($parser->parse($data) && $recurrency > 0) { |
|
52 | + while ($parser->parse($data) && $recurrency>0) { |
|
53 | 53 | |
54 | 54 | /** @var EsiRequest[] $esiRequests */ |
55 | 55 | $esiRequests = $parser->esiRequests(); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | private function createRequestPromises() |
73 | 73 | { |
74 | - return (function (array $esiRequests) { |
|
74 | + return (function(array $esiRequests) { |
|
75 | 75 | $client = new Client($this->clientOptions()); |
76 | 76 | /** @var EsiRequest $esiRequest */ |
77 | 77 | foreach ($esiRequests as $esiRequest) { |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | 'cache_ttl' => 3600, |
107 | 107 | 'request_options' => [], |
108 | 108 | 'recurecny_lever' => 1, |
109 | - 'fulfilled' => function (string &$data, array $esiRequests) |
|
109 | + 'fulfilled' => function(string&$data, array $esiRequests) |
|
110 | 110 | { |
111 | - return (function (Response $response, int $index) use (&$data, $esiRequests) |
|
111 | + return (function(Response $response, int $index) use (&$data, $esiRequests) |
|
112 | 112 | { |
113 | 113 | /** @var EsiRequest $esiRequest */ |
114 | 114 | $esiRequest = $esiRequests[$index]; |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | } |
134 | 134 | }); |
135 | 135 | }, |
136 | - 'rejected' => function (string &$data, array $esiRequests) { |
|
137 | - return (function (\Exception $reason, int $index) use (&$data, $esiRequests) { |
|
136 | + 'rejected' => function(string&$data, array $esiRequests) { |
|
137 | + return (function(\Exception $reason, int $index) use (&$data, $esiRequests) { |
|
138 | 138 | |
139 | 139 | $this->logger->error( |
140 | 140 | 'Could not fetch ['.$esiRequests[$index]->getSrc().']. Reason: '.$reason->getMessage() |