@@ -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 | } |
@@ -64,12 +64,12 @@ |
||
64 | 64 | Expect::that($value)->isFloat()->isGreaterThan(0); |
65 | 65 | } |
66 | 66 | |
67 | - private function validateCachePool(?CacheItemPoolInterface $value) : void |
|
67 | + private function validateCachePool(? CacheItemPoolInterface $value) : void |
|
68 | 68 | { |
69 | 69 | Expect::that($value)->isNullOrInstanceOf('Psr\Cache\CacheItemPoolInterface'); |
70 | 70 | } |
71 | 71 | |
72 | - private function validateLogger(?LoggerInterface $value) : void |
|
72 | + private function validateLogger(? LoggerInterface $value) : void |
|
73 | 73 | { |
74 | 74 | Expect::that($value)->isNullOrInstanceOf('Psr\Log\LoggerInterface'); |
75 | 75 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | $recurrence = $this->options['recurrence_level']; |
54 | 54 | |
55 | - while ($parser->parse($data) && $recurrence > 0) { |
|
55 | + while ($parser->parse($data) && $recurrence>0) { |
|
56 | 56 | |
57 | 57 | /** @var EsiRequest[] $esiRequests */ |
58 | 58 | $esiRequests = $parser->esiRequests(); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | private function createRequestPromises(): \Closure |
76 | 76 | { |
77 | - return (function (array $esiRequests) { |
|
77 | + return (function(array $esiRequests) { |
|
78 | 78 | $client = new Client($this->clientOptions()); |
79 | 79 | /** @var EsiRequest $esiRequest */ |
80 | 80 | foreach ($esiRequests as $esiRequest) { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | private function createSingleRequest(EsiRequest $esiRequest, Client $client) |
87 | 87 | { |
88 | - $cacheKey = $this->options['cache_prefix'] . ':' . base64_encode($esiRequest->getSrc()); |
|
88 | + $cacheKey = $this->options['cache_prefix'].':'.base64_encode($esiRequest->getSrc()); |
|
89 | 89 | |
90 | 90 | if ($this->cachePool instanceof CacheItemPoolInterface && $this->cachePool->hasItem($cacheKey)) { |
91 | 91 | return new Response(200, [], $this->cachePool->getItem($cacheKey)->get()); |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | |
120 | 120 | private function defaultFulfilled(): \Closure |
121 | 121 | { |
122 | - return function (string &$data, array $esiRequests) { |
|
123 | - return (function (Response $response, int $index) use (&$data, $esiRequests) { |
|
122 | + return function(string&$data, array $esiRequests) { |
|
123 | + return (function(Response $response, int $index) use (&$data, $esiRequests) { |
|
124 | 124 | /** @var EsiRequest $esiRequest */ |
125 | 125 | $esiRequest = $esiRequests[$index]; |
126 | 126 | $needle = $esiRequest->getEsiTag(); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | private function setCache(EsiRequest $esiRequest, string $content) |
140 | 140 | { |
141 | 141 | if ($this->cachePool instanceof CacheItemPoolInterface && !$esiRequest->noCache()) { |
142 | - $cacheKey = $this->options['cache_prefix'] . ':' . base64_encode($esiRequest->getSrc()); |
|
142 | + $cacheKey = $this->options['cache_prefix'].':'.base64_encode($esiRequest->getSrc()); |
|
143 | 143 | |
144 | 144 | $this->cachePool->save( |
145 | 145 | $this->cachePool |
@@ -152,20 +152,20 @@ discard block |
||
152 | 152 | |
153 | 153 | private function defaultReject(): \Closure |
154 | 154 | { |
155 | - return function (string &$data, array $esiRequests) { |
|
156 | - return (function (\Exception $reason, int $index) use (&$data, $esiRequests) { |
|
155 | + return function(string&$data, array $esiRequests) { |
|
156 | + return (function(\Exception $reason, int $index) use (&$data, $esiRequests) { |
|
157 | 157 | /** @var EsiRequest $esiRequest */ |
158 | 158 | $esiRequest = $esiRequests[$index]; |
159 | 159 | |
160 | 160 | $this->logger->error( |
161 | - 'Could not fetch [' . $esiRequest->getSrc() . ']. Reason: ' . $reason->getMessage() |
|
161 | + 'Could not fetch ['.$esiRequest->getSrc().']. Reason: '.$reason->getMessage() |
|
162 | 162 | ); |
163 | 163 | if ($reason instanceof ConnectException && |
164 | 164 | $this->options['on_timeout'] == static::ON_TIMEOUT_H_INCLUDE |
165 | 165 | ) { |
166 | 166 | $data = str_replace( |
167 | 167 | $esiRequest->getEsiTag(), |
168 | - '<hx:include src="' . $this->options['base_uri'] . $esiRequest->getSrc() . '"></hx:include>', |
|
168 | + '<hx:include src="'.$this->options['base_uri'].$esiRequest->getSrc().'"></hx:include>', |
|
169 | 169 | $data |
170 | 170 | ); |
171 | 171 | return; |