@@ -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 | } |
@@ -73,12 +73,12 @@ |
||
73 | 73 | Expect::that($value)->isFloat()->isGreaterThan(0); |
74 | 74 | } |
75 | 75 | |
76 | - private function validateCachePool(?CacheItemPoolInterface $value) : void |
|
76 | + private function validateCachePool(? CacheItemPoolInterface $value) : void |
|
77 | 77 | { |
78 | 78 | Expect::that($value)->isNullOrInstanceOf('Psr\Cache\CacheItemPoolInterface'); |
79 | 79 | } |
80 | 80 | |
81 | - private function validateLogger(?LoggerInterface $value) : void |
|
81 | + private function validateLogger(? LoggerInterface $value) : void |
|
82 | 82 | { |
83 | 83 | Expect::that($value)->isNullOrInstanceOf('sr\Log\LoggerInterface'); |
84 | 84 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | $recurrency = $this->options['recurecny_level']; |
54 | 54 | |
55 | - while ($parser->parse($data) && $recurrency > 0) { |
|
55 | + while ($parser->parse($data) && $recurrency>0) { |
|
56 | 56 | |
57 | 57 | /** @var EsiRequest[] $esiRequests */ |
58 | 58 | $esiRequests = $parser->esiRequests(); |
@@ -74,12 +74,12 @@ 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) { |
81 | 81 | |
82 | - $cacheKey = $this->options['cache_prefix'] . ':' . base64_encode($esiRequest->getSrc()); |
|
82 | + $cacheKey = $this->options['cache_prefix'].':'.base64_encode($esiRequest->getSrc()); |
|
83 | 83 | |
84 | 84 | if ($this->cachePool instanceof CacheItemPoolInterface && |
85 | 85 | $this->cachePool->hasItem($cacheKey) |
@@ -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(); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | if ($pos !== false) { |
129 | 129 | |
130 | 130 | if ($this->cachePool instanceof CacheItemPoolInterface && !$esiRequest->isNoCache()) { |
131 | - $cacheKey = $this->options['cache_prefix'] . ':' . base64_encode($esiRequest->getSrc()); |
|
131 | + $cacheKey = $this->options['cache_prefix'].':'.base64_encode($esiRequest->getSrc()); |
|
132 | 132 | |
133 | 133 | $this->cachePool->save( |
134 | 134 | $this->cachePool |
@@ -148,13 +148,13 @@ discard block |
||
148 | 148 | |
149 | 149 | private function defaultReject(): \Closure |
150 | 150 | { |
151 | - return function (string &$data, array $esiRequests) { |
|
152 | - return (function (\Exception $reason, int $index) use (&$data, $esiRequests) { |
|
151 | + return function(string&$data, array $esiRequests) { |
|
152 | + return (function(\Exception $reason, int $index) use (&$data, $esiRequests) { |
|
153 | 153 | /** @var EsiRequest $esiRequest */ |
154 | 154 | $esiRequest = $esiRequests[$index]; |
155 | 155 | |
156 | 156 | $this->logger->error( |
157 | - 'Could not fetch [' . $esiRequest->getSrc() . ']. Reason: ' . $reason->getMessage() |
|
157 | + 'Could not fetch ['.$esiRequest->getSrc().']. Reason: '.$reason->getMessage() |
|
158 | 158 | ); |
159 | 159 | if ($reason instanceof ConnectException && ( |
160 | 160 | $this->options['on_timeout'] == static::ON_TIMEOUT_H_INCLUDE |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | ) { |
163 | 163 | $data = str_replace( |
164 | 164 | $esiRequest->getEsiTag(), |
165 | - '<hx:include src="' . $this->options['base_uri'] . $esiRequest->getSrc() . '"></hx:include>', |
|
165 | + '<hx:include src="'.$this->options['base_uri'].$esiRequest->getSrc().'"></hx:include>', |
|
166 | 166 | $data |
167 | 167 | ); |
168 | 168 | return; |