@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | use DI\Container; |
| 4 | 4 | use Doctrine\Common\Cache\Cache; |
@@ -8,11 +8,11 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | return [ |
| 10 | 10 | // external libraries |
| 11 | - Goutte\Client::class => function () { |
|
| 11 | + Goutte\Client::class => function() { |
|
| 12 | 12 | return new Goutte\Client(); |
| 13 | 13 | }, |
| 14 | 14 | |
| 15 | - Cache::class => function (Container $container) { |
|
| 15 | + Cache::class => function(Container $container) { |
|
| 16 | 16 | $cache = $container->get('config')->get('cache'); |
| 17 | 17 | |
| 18 | 18 | if (!$cache instanceof Cache) { |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | return $cache; |
| 23 | 23 | }, |
| 24 | 24 | |
| 25 | - LoggerInterface::class => function () { |
|
| 25 | + LoggerInterface::class => function() { |
|
| 26 | 26 | $log = new Logger('wolnosciowiec.webproxy'); |
| 27 | 27 | $log->pushHandler(new StreamHandler(__DIR__ . '/../../var/app.log', Logger::INFO)); |
| 28 | 28 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | use DI\Container; |
| 4 | 4 | use Doctrine\Common\Cache\Cache; |
@@ -13,42 +13,42 @@ discard block |
||
| 13 | 13 | use Wolnosciowiec\WebProxy\Service\Proxy\ProxySelector; |
| 14 | 14 | |
| 15 | 15 | return [ |
| 16 | - 'config' => function () { |
|
| 16 | + 'config' => function() { |
|
| 17 | 17 | return new \Doctrine\Common\Collections\ArrayCollection(require __DIR__ . '/../../config.php'); |
| 18 | 18 | }, |
| 19 | 19 | |
| 20 | - ProxySelector::class => function (Container $container) { |
|
| 20 | + ProxySelector::class => function(Container $container) { |
|
| 21 | 21 | return new ProxySelector($container->get(ProxyProviderInterface::class)); |
| 22 | 22 | }, |
| 23 | 23 | |
| 24 | - ProxyProviderFactory::class => function (Container $container) { |
|
| 24 | + ProxyProviderFactory::class => function(Container $container) { |
|
| 25 | 25 | |
| 26 | 26 | /** @var \Doctrine\Common\Collections\ArrayCollection $config */ |
| 27 | 27 | $config = $container->get('config'); |
| 28 | 28 | |
| 29 | 29 | return new ProxyProviderFactory( |
| 30 | - (string)$config->get('externalProxyProviders'), |
|
| 30 | + (string) $config->get('externalProxyProviders'), |
|
| 31 | 31 | $container->get(Cache::class), |
| 32 | 32 | $container |
| 33 | 33 | ); |
| 34 | 34 | }, |
| 35 | 35 | |
| 36 | - RequestFactory::class => function () { |
|
| 36 | + RequestFactory::class => function() { |
|
| 37 | 37 | return new RequestFactory(); |
| 38 | 38 | }, |
| 39 | 39 | |
| 40 | - ProxyClientFactory::class => function (Container $container) { |
|
| 40 | + ProxyClientFactory::class => function(Container $container) { |
|
| 41 | 41 | return new ProxyClientFactory( |
| 42 | 42 | $container->get(ProxySelector::class), |
| 43 | - (int)$container->get('config')->get('connectionTimeout') |
|
| 43 | + (int) $container->get('config')->get('connectionTimeout') |
|
| 44 | 44 | ); |
| 45 | 45 | }, |
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | // controllers |
| 49 | - PassThroughController::class => function (Container $container) { |
|
| 49 | + PassThroughController::class => function(Container $container) { |
|
| 50 | 50 | return new PassThroughController( |
| 51 | - (int)$container->get('config')->get('maxRetries'), |
|
| 51 | + (int) $container->get('config')->get('maxRetries'), |
|
| 52 | 52 | $container->get(ProxyClientFactory::class), |
| 53 | 53 | $container->get(RequestFactory::class), |
| 54 | 54 | $container->get(LoggerInterface::class) |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | // providers |
| 61 | - FreeProxyListProvider::class => function (Container $container) { |
|
| 61 | + FreeProxyListProvider::class => function(Container $container) { |
|
| 62 | 62 | return new FreeProxyListProvider($container->get(Goutte\Client::class)); |
| 63 | 63 | }, |
| 64 | 64 | |
| 65 | - ProxyProviderInterface::class => function (Container $container) { |
|
| 65 | + ProxyProviderInterface::class => function(Container $container) { |
|
| 66 | 66 | return $container->get(ProxyProviderFactory::class)->create(); |
| 67 | 67 | }, |
| 68 | 68 | ]; |
@@ -128,7 +128,7 @@ |
||
| 128 | 128 | { |
| 129 | 129 | // fix: empty response if page is using gzip (Zend Diactoros is trying to do the same, but it's doing it incorrectly) |
| 130 | 130 | if (!$response->hasHeader('Content-Length')) { |
| 131 | - $response = $response->withAddedHeader('Content-Length', strlen((string)$response->getBody())); |
|
| 131 | + $response = $response->withAddedHeader('Content-Length', strlen((string) $response->getBody())); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | // we are not using any encoding at the output |
@@ -151,12 +151,10 @@ |
||
| 151 | 151 | if ($code === 404) { |
| 152 | 152 | header('HTTP/1.0 404 Not Found'); |
| 153 | 153 | return; |
| 154 | - } |
|
| 155 | - elseif ($code === 403) { |
|
| 154 | + } elseif ($code === 403) { |
|
| 156 | 155 | header('HTTP 1.1 403 Unauthorized'); |
| 157 | 156 | return; |
| 158 | - } |
|
| 159 | - elseif ($code === 400) { |
|
| 157 | + } elseif ($code === 400) { |
|
| 160 | 158 | header('HTTP/1.0 400 Bad Request'); |
| 161 | 159 | return; |
| 162 | 160 | } |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | // @codeCoverageIgnoreStart |
| 4 | 4 | use DI\Definition\Source\DefinitionFile; |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | public function __construct() |
| 18 | 18 | { |
| 19 | 19 | if (!is_file(__DIR__ . '/../../config.php')) { // @codeCoverageIgnore |
| 20 | - throw new \Exception('config.php file was not found'); // @codeCoverageIgnore |
|
| 20 | + throw new \Exception('config.php file was not found'); // @codeCoverageIgnore |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | $settings = require __DIR__ . '/../../config.php'; |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Wolnosciowiec\WebProxy\Service\Proxy; |
| 4 | 4 | |