@@ -55,13 +55,13 @@ |
||
| 55 | 55 | { |
| 56 | 56 | if ($this->getLocation()) { |
| 57 | 57 | try { |
| 58 | - $response = $this->client->request('GET', $this->getLocation(), ['stream' => true]); |
|
| 58 | + $response = $this->client->request('GET', $this->getLocation(), ['stream' => true]); |
|
| 59 | 59 | if ($response instanceof ResponseInterface) { |
| 60 | 60 | if ($response->getStatusCode() === 200) { |
| 61 | 61 | return $response->getBody(); |
| 62 | 62 | } else { |
| 63 | 63 | throw new CollectorFetchException( |
| 64 | - 'Failed fetching with response status code: '.$response->getStatusCode() |
|
| 64 | + 'Failed fetching with response status code: ' . $response->getStatusCode() |
|
| 65 | 65 | ); |
| 66 | 66 | } |
| 67 | 67 | } else { |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | public function filter($in, $out, &$consumed, $closing) |
| 14 | 14 | { |
| 15 | 15 | while ($bucket = stream_bucket_make_writeable($in)) { |
| 16 | - $bucket = $this->processBucket($bucket); |
|
| 16 | + $bucket = $this->processBucket($bucket); |
|
| 17 | 17 | $consumed = $bucket->datalen; |
| 18 | 18 | stream_bucket_prepend($out, $bucket); |
| 19 | 19 | } |
@@ -50,8 +50,7 @@ discard block |
||
| 50 | 50 | public function getParseWarningThreshold() |
| 51 | 51 | { |
| 52 | 52 | return is_null($this->parseWarningThreshold) ? |
| 53 | - self::DEFAULT_PARSE_WARNING_THRESHOLD : |
|
| 54 | - $this->parseWarningThreshold; |
|
| 53 | + self::DEFAULT_PARSE_WARNING_THRESHOLD : $this->parseWarningThreshold; |
|
| 55 | 54 | } |
| 56 | 55 | |
| 57 | 56 | /** |
@@ -77,7 +76,7 @@ discard block |
||
| 77 | 76 | */ |
| 78 | 77 | protected function getStreamData(StreamInterface $data = null) |
| 79 | 78 | { |
| 80 | - if (! is_null($data)) { |
|
| 79 | + if (!is_null($data)) { |
|
| 81 | 80 | return $data; |
| 82 | 81 | } |
| 83 | 82 | if ($this->getCollector()) { |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | $store->iplist = $ipList; |
| 77 | 77 | $store->expires = $this->calculateExpiration($ttl)->format('c'); |
| 78 | 78 | |
| 79 | - if (! is_writable(dirname($this->getLocation())) || |
|
| 80 | - (file_exists($this->getLocation()) && ! is_writable($this->getLocation())) |
|
| 79 | + if (!is_writable(dirname($this->getLocation())) || |
|
| 80 | + (file_exists($this->getLocation()) && !is_writable($this->getLocation())) |
|
| 81 | 81 | ) { |
| 82 | 82 | return false; |
| 83 | 83 | } |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function fetch() |
| 91 | 91 | { |
| 92 | - if (! is_readable($this->getLocation())) { |
|
| 92 | + if (!is_readable($this->getLocation())) { |
|
| 93 | 93 | return null; |
| 94 | 94 | } |
| 95 | 95 | $data = json_decode(file_get_contents($this->getLocation())); |
| 96 | - if (! isset($data->iplist) || ! isset($data->expires)) { |
|
| 96 | + if (!isset($data->iplist) || !isset($data->expires)) { |
|
| 97 | 97 | return null; |
| 98 | 98 | } |
| 99 | 99 | if (new \DateTime($data->expires) < new \DateTime()) { |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | protected function calculateExpiration($ttl = null) |
| 112 | 112 | { |
| 113 | - if (! is_int($ttl) && $ttl < 1) { |
|
| 113 | + if (!is_int($ttl) && $ttl < 1) { |
|
| 114 | 114 | throw new \InvalidArgumentException('Invalid ttl.'); |
| 115 | 115 | } |
| 116 | 116 | return new \DateTime(sprintf('+%d seconds', $ttl)); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | public function __construct(array $addresses = array()) |
| 21 | 21 | { |
| 22 | 22 | $this->position = 0; |
| 23 | - if (! empty($addresses)) { |
|
| 23 | + if (!empty($addresses)) { |
|
| 24 | 24 | $this->add($addresses); |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | public static function fromParserWithCache(ParserInterface $parser, IpListCacheInterface $cache) |
| 50 | 50 | { |
| 51 | 51 | $ipList = $cache->fetch(); |
| 52 | - if (! is_null($ipList)) { |
|
| 52 | + if (!is_null($ipList)) { |
|
| 53 | 53 | return $ipList; |
| 54 | 54 | } else { |
| 55 | 55 | $ipList = self::fromParser($parser); |
| 56 | - if (! empty($ipList)) { |
|
| 57 | - if (! $cache->store($ipList)) { |
|
| 56 | + if (!empty($ipList)) { |
|
| 57 | + if (!$cache->store($ipList)) { |
|
| 58 | 58 | throw new \RuntimeException('Failed storing new tor exit node list in cache.'); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -72,13 +72,13 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function add($addresses) |
| 74 | 74 | { |
| 75 | - if (! is_array($addresses)) { |
|
| 75 | + if (!is_array($addresses)) { |
|
| 76 | 76 | $addresses = (array) $addresses; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | foreach ($addresses as $address) { |
| 80 | 80 | $ip = ip2long($address); |
| 81 | - if ($ip && ! isset($this->addressInList[$ip])) { |
|
| 81 | + if ($ip && !isset($this->addressInList[$ip])) { |
|
| 82 | 82 | $this->addresses[] = $ip; |
| 83 | 83 | $this->addressInList[$ip] = true; |
| 84 | 84 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function remove($addresses) |
| 97 | 97 | { |
| 98 | - if (! is_array($addresses)) { |
|
| 98 | + if (!is_array($addresses)) { |
|
| 99 | 99 | $addresses = (array) $addresses; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function doesNotContain($address) |
| 144 | 144 | { |
| 145 | - return ! $this->contains($address); |
|
| 145 | + return !$this->contains($address); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |