@@ -28,7 +28,7 @@ |
||
28 | 28 | */ |
29 | 29 | public function getDefaultDriver() |
30 | 30 | { |
31 | - return $this->app['config']['url-shortener.default']; |
|
31 | + return $this->app[ 'config' ][ 'url-shortener.default' ]; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | $this->app->bindIf(ClientInterface::class, Client::class); |
49 | 49 | |
50 | - $this->app->singleton('url.shortener', function ($app) { |
|
50 | + $this->app->singleton('url.shortener', function($app) { |
|
51 | 51 | return new UrlShortenerManager($app); |
52 | 52 | }); |
53 | 53 | } |
@@ -63,15 +63,15 @@ discard block |
||
63 | 63 | return; |
64 | 64 | } |
65 | 65 | |
66 | - UrlGenerator::macro('shorten', function (...$parameters) { |
|
66 | + UrlGenerator::macro('shorten', function(...$parameters) { |
|
67 | 67 | return app('url.shortener')->shorten(...$parameters); |
68 | 68 | }); |
69 | 69 | |
70 | - UrlGenerator::macro('shortener', function () { |
|
70 | + UrlGenerator::macro('shortener', function() { |
|
71 | 71 | return app('url.shortener'); |
72 | 72 | }); |
73 | 73 | |
74 | - UrlGenerator::macro('shortenUsing', function (string $driver, ...$parameters) { |
|
74 | + UrlGenerator::macro('shortenUsing', function(string $driver, ...$parameters) { |
|
75 | 75 | return app('url.shortener')->shortener($driver)->shorten(...$parameters); |
76 | 76 | }); |
77 | 77 | } |
@@ -11,5 +11,5 @@ |
||
11 | 11 | * @param array $options |
12 | 12 | * @return string |
13 | 13 | */ |
14 | - public function shorten($url, array $options = []); |
|
14 | + public function shorten($url, array $options = [ ]); |
|
15 | 15 | } |
@@ -11,5 +11,5 @@ |
||
11 | 11 | * @param array $options |
12 | 12 | * @return \GuzzleHttp\Promise\PromiseInterface |
13 | 13 | */ |
14 | - public function shortenAsync($url, array $options = []); |
|
14 | + public function shortenAsync($url, array $options = [ ]); |
|
15 | 15 | } |
@@ -41,12 +41,12 @@ |
||
41 | 41 | /** |
42 | 42 | * {@inheritDoc} |
43 | 43 | */ |
44 | - public function shortenAsync($url, array $options = []) |
|
44 | + public function shortenAsync($url, array $options = [ ]) |
|
45 | 45 | { |
46 | 46 | $options = array_merge(Arr::add($this->defaults, 'json.long_url', $url), $options); |
47 | 47 | $request = new Request('POST', '/v4/shorten'); |
48 | 48 | |
49 | - return $this->client->sendAsync($request, $options)->then(function (ResponseInterface $response) { |
|
49 | + return $this->client->sendAsync($request, $options)->then(function(ResponseInterface $response) { |
|
50 | 50 | return str_replace('http://', 'https://', json_decode($response->getBody()->getContents())->link); |
51 | 51 | }); |
52 | 52 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | /** |
10 | 10 | * {@inheritDoc} |
11 | 11 | */ |
12 | - public function shorten($url, array $options = []) |
|
12 | + public function shorten($url, array $options = [ ]) |
|
13 | 13 | { |
14 | 14 | return $this->shortenAsync($url, $options)->wait(); |
15 | 15 | } |
@@ -29,12 +29,12 @@ |
||
29 | 29 | /** |
30 | 30 | * {@inheritDoc} |
31 | 31 | */ |
32 | - public function shortenAsync($url, array $options = []) |
|
32 | + public function shortenAsync($url, array $options = [ ]) |
|
33 | 33 | { |
34 | 34 | $options = array_merge(Arr::add(static::defaults, 'query.url', $url), $options); |
35 | 35 | $request = new Request('GET', '/api-create.php'); |
36 | 36 | |
37 | - return $this->client->sendAsync($request, $options)->then(function (ResponseInterface $response) { |
|
37 | + return $this->client->sendAsync($request, $options)->then(function(ResponseInterface $response) { |
|
38 | 38 | return str_replace('http://', 'https://', $response->getBody()->getContents()); |
39 | 39 | }); |
40 | 40 | } |