@@ -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 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $this->logger = (isset($options['logger'])) ? $options['logger'] : new VoidLogger(); |
41 | 41 | } |
42 | 42 | |
43 | - public function setCache(?CacheItemPoolInterface $cachePool) : Mantle |
|
43 | + public function setCache(? CacheItemPoolInterface $cachePool) : Mantle |
|
44 | 44 | { |
45 | 45 | $this->cachePool = $cachePool; |
46 | 46 | return $this; |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | return $data; |
72 | 72 | } |
73 | 73 | |
74 | - private function handleFulfilled(string &$data, array $esiRequests) |
|
74 | + private function handleFulfilled(string&$data, array $esiRequests) |
|
75 | 75 | { |
76 | - return (function (Response $response, int $index) use (&$data, $esiRequests) |
|
76 | + return (function(Response $response, int $index) use (&$data, $esiRequests) |
|
77 | 77 | { |
78 | 78 | $needle = $esiRequests[$index]->getEsiTag(); |
79 | 79 | $pos = strpos($data, $needle); |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | }); |
86 | 86 | } |
87 | 87 | |
88 | - private function handleRejected(string &$data, array $esiRequests) { |
|
88 | + private function handleRejected(string&$data, array $esiRequests) { |
|
89 | 89 | if ($this->options['on_reject'] instanceof \Closure) { |
90 | 90 | return $this->options['on_reject']($data, $esiRequests); |
91 | 91 | } |
92 | 92 | |
93 | - return (function (\Exception $reason, int $index) use (&$data, $esiRequests) { |
|
93 | + return (function(\Exception $reason, int $index) use (&$data, $esiRequests) { |
|
94 | 94 | |
95 | 95 | $this->logger->error( |
96 | 96 | 'Could not fetch ['.$esiRequests[$index]->getSrc().']. Reason: '.$reason->getMessage() |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | private function createRequestPromises() |
108 | 108 | { |
109 | - return (function (array $esiRequests) { |
|
109 | + return (function(array $esiRequests) { |
|
110 | 110 | $client = new Client($this->clientOptions()); |
111 | 111 | /** @var EsiRequest $esiRequest */ |
112 | 112 | foreach ($esiRequests as $esiRequest) { |
@@ -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 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | if (isset($this->attributes['TIMEOUT'])) { |
26 | - if ((float)$this->attributes['TIMEOUT'] <=0 ) { |
|
26 | + if ((float)$this->attributes['TIMEOUT']<=0) { |
|
27 | 27 | throw new EsiTagParseException("Timeout must be greater then 0."); |
28 | 28 | } |
29 | 29 | } |
@@ -7,8 +7,8 @@ |
||
7 | 7 | * @param \CrazyGoat\Octophpus\EsiRequest[] $esiRequests |
8 | 8 | * @return Closure |
9 | 9 | */ |
10 | -$reject_closure = function (string &$data, array $esiRequests) { |
|
11 | - return (function (\Exception $reason, int $index) use (&$data, $esiRequests) { |
|
10 | +$reject_closure = function(string&$data, array $esiRequests) { |
|
11 | + return (function(\Exception $reason, int $index) use (&$data, $esiRequests) { |
|
12 | 12 | echo "Unable to fetch request (".$esiRequests[$index]->getSrc().") reason : ".$reason->getMessage(); |
13 | 13 | $reason; |
14 | 14 | }); |