@@ -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 | } |
@@ -36,12 +36,12 @@ |
||
36 | 36 | /** |
37 | 37 | * {@inheritDoc} |
38 | 38 | */ |
39 | - public function shortenAsync($url, array $options = []) |
|
39 | + public function shortenAsync($url, array $options = [ ]) |
|
40 | 40 | { |
41 | 41 | $options = array_merge($this->defaults, $options); |
42 | - $request = new Request('PUT', '/v1/data/url', [], http_build_query(['urlToShorten' => $url])); |
|
42 | + $request = new Request('PUT', '/v1/data/url', [ ], http_build_query([ 'urlToShorten' => $url ])); |
|
43 | 43 | |
44 | - return $this->client->sendAsync($request, $options)->then(function (ResponseInterface $response) { |
|
44 | + return $this->client->sendAsync($request, $options)->then(function(ResponseInterface $response) { |
|
45 | 45 | return json_decode($response->getBody()->getContents())->shortenedUrl; |
46 | 46 | }); |
47 | 47 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $this->app->alias('url.shortener', UrlShortenerManager::class); |
49 | 49 | $this->app->bindIf(ClientInterface::class, Client::class); |
50 | 50 | |
51 | - $this->app->singleton('url.shortener', function ($app) { |
|
51 | + $this->app->singleton('url.shortener', function($app) { |
|
52 | 52 | return new UrlShortenerManager($app); |
53 | 53 | }); |
54 | 54 | } |
@@ -64,15 +64,15 @@ discard block |
||
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
67 | - UrlGenerator::macro('shorten', function (...$parameters) { |
|
67 | + UrlGenerator::macro('shorten', function(...$parameters) { |
|
68 | 68 | return app('url.shortener')->shorten(...$parameters); |
69 | 69 | }); |
70 | 70 | |
71 | - UrlGenerator::macro('shortenAsync', function (...$parameters) { |
|
71 | + UrlGenerator::macro('shortenAsync', function(...$parameters) { |
|
72 | 72 | return app('url.shortener')->shortenAsync(...$parameters); |
73 | 73 | }); |
74 | 74 | |
75 | - UrlGenerator::macro('shortener', function () { |
|
75 | + UrlGenerator::macro('shortener', function() { |
|
76 | 76 | return app('url.shortener'); |
77 | 77 | }); |
78 | 78 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function getDefaultDriver() |
77 | 77 | { |
78 | - return $this->app['config']['url-shortener.default']; |
|
78 | + return $this->app[ 'config' ][ 'url-shortener.default' ]; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -86,6 +86,6 @@ discard block |
||
86 | 86 | */ |
87 | 87 | protected function getDriverConfig(string $name) |
88 | 88 | { |
89 | - return $this->app['config']["url-shortener.drivers.$name"] ?: []; |
|
89 | + return $this->app[ 'config' ][ "url-shortener.drivers.$name" ] ?: [ ]; |
|
90 | 90 | } |
91 | 91 | } |