@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | $supported = collect($resources) |
70 | 70 | ->merge($this->settings['global_pushes']) |
71 | - ->filter(function ($resource) { |
|
71 | + ->filter(function($resource) { |
|
72 | 72 | return array_key_exists($this->getExtension($resource), $this->extensionTypes); |
73 | 73 | }); |
74 | 74 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | private function transform(Collection $collection): Collection |
107 | 107 | { |
108 | - return $collection->map(function ($path) { |
|
108 | + return $collection->map(function($path) { |
|
109 | 109 | $hash = $this->retrieveHash($path); |
110 | 110 | |
111 | 111 | $extension = $this->getExtension($path); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | |
179 | 179 | $cached = json_decode($cache, true); |
180 | 180 | |
181 | - return $pushable->filter(function ($item) use ($cached) { |
|
181 | + return $pushable->filter(function($item) use ($cached) { |
|
182 | 182 | return !in_array($item, $cached); |
183 | 183 | }); |
184 | 184 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | */ |
193 | 193 | private function buildLink(Collection $pushable): string |
194 | 194 | { |
195 | - return $pushable->map(function ($item) { |
|
195 | + return $pushable->map(function($item) { |
|
196 | 196 | $push = "<{$item['path']}>; rel=preload; as={$item['type']}"; |
197 | 197 | |
198 | 198 | if ($item['type'] === 'font') { |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * |
16 | 16 | * @var string |
17 | 17 | */ |
18 | - private $config = __DIR__ . '/../config/http2-pusher.php'; |
|
18 | + private $config = __DIR__.'/../config/http2-pusher.php'; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Bootstrap any application services. |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | private function registerBuilder() |
52 | 52 | { |
53 | - $this->app->singleton(Builder::class, function ($app) { |
|
53 | + $this->app->singleton(Builder::class, function($app) { |
|
54 | 54 | return new Builder( |
55 | 55 | $app['request'], |
56 | 56 | $app['config']['http2-pusher'] |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | private function registerResponse() |
67 | 67 | { |
68 | - $this->app->singleton(ResponseFactoryContract::class, function ($app) { |
|
68 | + $this->app->singleton(ResponseFactoryContract::class, function($app) { |
|
69 | 69 | return new ResponseFactory($app[ViewFactoryContract::class], $app['redirect']); |
70 | 70 | }); |
71 | 71 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $crawler = new Crawler($response->content()); |
61 | 61 | |
62 | 62 | $content = $crawler->filter('link, script[src], img[src]') |
63 | - ->extract(['src', 'href']); |
|
63 | + ->extract(['src', 'href']); |
|
64 | 64 | |
65 | 65 | // TODO: Ordering might be necessary for manifest files due to https://laravel.com/docs/5.5/mix#vendor-extraction |
66 | 66 | return collect($content)->flatten(1) |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | if ($push !== null) { |
22 | 22 | $this->header('Link', $push->getLink()) |
23 | - ->withCookie($push->getCookie()); |
|
23 | + ->withCookie($push->getCookie()); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | return $this; |
@@ -61,7 +61,7 @@ |
||
61 | 61 | { |
62 | 62 | // The function "public_path" is in "Illuminate/Foundation" which is no standalone dependency. |
63 | 63 | Container::getInstance() |
64 | - ->instance('path.public', __DIR__ . DIRECTORY_SEPARATOR . 'fixtures'); |
|
64 | + ->instance('path.public', __DIR__ . DIRECTORY_SEPARATOR . 'fixtures'); |
|
65 | 65 | |
66 | 66 | $this->request = new Request(); |
67 | 67 | $this->builder = new Builder($this->request, $this->builderSettings); |
@@ -61,7 +61,7 @@ |
||
61 | 61 | { |
62 | 62 | // The function "public_path" is in "Illuminate/Foundation" which is no standalone dependency. |
63 | 63 | Container::getInstance() |
64 | - ->instance('path.public', __DIR__ . DIRECTORY_SEPARATOR . 'fixtures'); |
|
64 | + ->instance('path.public', __DIR__.DIRECTORY_SEPARATOR.'fixtures'); |
|
65 | 65 | |
66 | 66 | $this->request = new Request(); |
67 | 67 | $this->builder = new Builder($this->request, $this->builderSettings); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | /** @test */ |
41 | 41 | public function it_should_not_push_anything_when_its_a_redirect_response() |
42 | 42 | { |
43 | - $response = function ($request) { |
|
43 | + $response = function($request) { |
|
44 | 44 | return new RedirectResponse('http://laravel.com'); |
45 | 45 | }; |
46 | 46 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | { |
59 | 59 | $this->request->headers->set('Content-Type', 'application/json'); |
60 | 60 | |
61 | - $response = function ($request) { |
|
61 | + $response = function($request) { |
|
62 | 62 | return new Response; |
63 | 63 | }; |
64 | 64 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | { |
76 | 76 | $this->request->headers->set('X-Requested-With', 'XMLHttpRequest'); |
77 | 77 | |
78 | - $response = function ($request) { |
|
78 | + $response = function($request) { |
|
79 | 79 | return new Response; |
80 | 80 | }; |
81 | 81 | |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | */ |
172 | 172 | private function getResponse($page) |
173 | 173 | { |
174 | - return function ($request) use ($page) { |
|
174 | + return function($request) use ($page) { |
|
175 | 175 | return new Response( |
176 | - file_get_contents(__DIR__ . "/fixtures/pages/{$page}.html") |
|
176 | + file_get_contents(__DIR__."/fixtures/pages/{$page}.html") |
|
177 | 177 | ); |
178 | 178 | }; |
179 | 179 | } |
@@ -15,6 +15,6 @@ |
||
15 | 15 | $destination = ($path ? DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR) : $path); |
16 | 16 | |
17 | 17 | return Container::getInstance() |
18 | - ->make('path.public') . $destination; |
|
18 | + ->make('path.public').$destination; |
|
19 | 19 | } |
20 | 20 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function it_should_return_null_when_the_given_resources_already_got_cached() |
119 | 119 | { |
120 | 120 | $cache = $this->transform($this->pushable) |
121 | - ->toJson(); |
|
121 | + ->toJson(); |
|
122 | 122 | |
123 | 123 | $cookies = [ |
124 | 124 | $this->builderSettings['cookie']['name'] => $cache, |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $pushed = array_slice($this->pushable, 0, 4); |
140 | 140 | |
141 | 141 | $cache = $this->transform($pushed) |
142 | - ->toJson(); |
|
142 | + ->toJson(); |
|
143 | 143 | |
144 | 144 | $cookies = [ |
145 | 145 | $this->builderSettings['cookie']['name'] => $cache, |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | 'https://laravel.com/assets/img/laravel-logo-white.png', |
21 | 21 | ]); |
22 | 22 | |
23 | - $resources->each(function ($resource, $index) use ($resources, $method) { |
|
23 | + $resources->each(function($resource, $index) use ($resources, $method) { |
|
24 | 24 | $hash = $method->invokeArgs($this->builder, [$resource]); |
25 | 25 | |
26 | 26 | $this->assertNotNull($hash); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | $transformed = $this->transform($this->pushable); |
41 | 41 | |
42 | - $transformed->each(function ($item) { |
|
42 | + $transformed->each(function($item) { |
|
43 | 43 | $this->assertArrayHasKey('type', $item); |
44 | 44 | $this->assertFalse($item['type'] === null); |
45 | 45 | $this->assertArrayHasKey('hash', $item); |