@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $this->client = $client; |
| 26 | 26 | $this->defaults = [ |
| 27 | 27 | 'allow_redirects' => false, |
| 28 | - 'base_uri' => (string)$baseUri, |
|
| 28 | + 'base_uri' => (string) $baseUri, |
|
| 29 | 29 | 'query' => [ |
| 30 | 30 | 'format' => 'simple', |
| 31 | 31 | 'logstats' => intval($statistics), |
@@ -36,12 +36,12 @@ discard block |
||
| 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 = Arr::add(array_merge($this->defaults, $options), 'query.url', $url); |
| 42 | 42 | $request = new Request('GET', '/create.php'); |
| 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 $response->getBody()->getContents(); |
| 46 | 46 | }); |
| 47 | 47 | } |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | public function __construct(Application $app) |
| 32 | 32 | { |
| 33 | 33 | $this->app = $app; |
| 34 | - $this->customCreators = []; |
|
| 35 | - $this->shorteners = []; |
|
| 34 | + $this->customCreators = [ ]; |
|
| 35 | + $this->shorteners = [ ]; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | protected function callCustomCreator(array $config) |
| 45 | 45 | { |
| 46 | - return $this->customCreators[$config['driver']]($this->app, $config); |
|
| 46 | + return $this->customCreators[ $config[ 'driver' ] ]($this->app, $config); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function extend(string $name, Closure $callback) |
| 158 | 158 | { |
| 159 | - $this->customCreators[$name] = $callback->bindTo($this, $this); |
|
| 159 | + $this->customCreators[ $name ] = $callback->bindTo($this, $this); |
|
| 160 | 160 | |
| 161 | 161 | return $this; |
| 162 | 162 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | public function getDefaultDriver() |
| 170 | 170 | { |
| 171 | - return $this->app['config']['url-shortener.default']; |
|
| 171 | + return $this->app[ 'config' ][ 'url-shortener.default' ]; |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | protected function getShortenerConfig(string $name) |
| 181 | 181 | { |
| 182 | - return $this->app['config']["url-shortener.shorteners.$name"]; |
|
| 182 | + return $this->app[ 'config' ][ "url-shortener.shorteners.$name" ]; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -196,16 +196,16 @@ discard block |
||
| 196 | 196 | throw new InvalidArgumentException("URL shortener [{$name}] is not defined"); |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - if (array_key_exists($config['driver'], $this->customCreators)) { |
|
| 199 | + if (array_key_exists($config[ 'driver' ], $this->customCreators)) { |
|
| 200 | 200 | return $this->callCustomCreator($config); |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - $driverMethod = 'create' . Str::studly($config['driver']) . 'Driver'; |
|
| 203 | + $driverMethod = 'create' . Str::studly($config[ 'driver' ]) . 'Driver'; |
|
| 204 | 204 | |
| 205 | 205 | if (method_exists($this, $driverMethod)) { |
| 206 | 206 | return $this->$driverMethod($config); |
| 207 | 207 | } |
| 208 | - throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported"); |
|
| 208 | + throw new InvalidArgumentException("Driver [{$config[ 'driver' ]}] is not supported"); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | public function setDefaultDriver(string $name) |
| 218 | 218 | { |
| 219 | - $this->app['config']['url-shortener.default'] = $name; |
|
| 219 | + $this->app[ 'config' ][ 'url-shortener.default' ] = $name; |
|
| 220 | 220 | |
| 221 | 221 | return $this; |
| 222 | 222 | } |
@@ -229,9 +229,9 @@ discard block |
||
| 229 | 229 | $name = $name ?: $this->getDefaultDriver(); |
| 230 | 230 | |
| 231 | 231 | if (array_key_exists($name, $this->shorteners)) { |
| 232 | - return $this->shorteners[$name]; |
|
| 232 | + return $this->shorteners[ $name ]; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - return $this->shorteners[$name] = $this->resolve($name); |
|
| 235 | + return $this->shorteners[ $name ] = $this->resolve($name); |
|
| 236 | 236 | } |
| 237 | 237 | } |