@@ -29,10 +29,10 @@ |
||
29 | 29 | { |
30 | 30 | $table = $this->table('redirects'); |
31 | 31 | $table->addColumn('hash', 'string') |
32 | - ->addColumn('redirect_to', 'text') |
|
33 | - ->addColumn('count', 'integer', ['default' => 0]) |
|
34 | - ->addColumn('created_at', 'datetime') |
|
35 | - ->addColumn('updated_at', 'datetime') |
|
36 | - ->create(); |
|
32 | + ->addColumn('redirect_to', 'text') |
|
33 | + ->addColumn('count', 'integer', ['default' => 0]) |
|
34 | + ->addColumn('created_at', 'datetime') |
|
35 | + ->addColumn('updated_at', 'datetime') |
|
36 | + ->create(); |
|
37 | 37 | } |
38 | 38 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | $table = $this->table('redirects'); |
31 | 31 | $table->addColumn('hash', 'string') |
32 | 32 | ->addColumn('redirect_to', 'text') |
33 | - ->addColumn('count', 'integer', ['default' => 0]) |
|
33 | + ->addColumn('count', 'integer', [ 'default' => 0 ]) |
|
34 | 34 | ->addColumn('created_at', 'datetime') |
35 | 35 | ->addColumn('updated_at', 'datetime') |
36 | 36 | ->create(); |
@@ -42,7 +42,7 @@ |
||
42 | 42 | */ |
43 | 43 | public function getUrlAttribute() |
44 | 44 | { |
45 | - return config()['base_url'] . '/' . $this->hash; |
|
45 | + return config()[ 'base_url' ] . '/' . $this->hash; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * @param array $data array of variables to extract |
7 | 7 | * @return void |
8 | 8 | */ |
9 | -function view($location, $data = []) |
|
9 | +function view($location, $data = [ ]) |
|
10 | 10 | { |
11 | 11 | ob_start(); |
12 | 12 | extract($data); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function isAuthorized() |
57 | 57 | { |
58 | 58 | $auth = substr($this->request->getHeaderLine('Authorization'), 7); |
59 | - return $this->request->getAttribute('config')['api_secret'] === $auth; |
|
59 | + return $this->request->getAttribute('config')[ 'api_secret' ] === $auth; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | public function create() |
78 | 78 | { |
79 | 79 | $body = $this->request->getAttribute('body'); |
80 | - if (isset($body['url'])) { |
|
81 | - return new JsonResponse(Redirect::createUnique($body['url'])); |
|
80 | + if (isset($body[ 'url' ])) { |
|
81 | + return new JsonResponse(Redirect::createUnique($body[ 'url' ])); |
|
82 | 82 | } |
83 | 83 | return new JsonResponse([ |
84 | 84 | 'message' => 'Request must include json body with url property.' |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | case "POST /redirects": |
100 | 100 | return $this->create(); |
101 | 101 | default: |
102 | - return new JsonResponse(['status' => 'No such api endpoint'], 404); |
|
102 | + return new JsonResponse([ 'status' => 'No such api endpoint' ], 404); |
|
103 | 103 | } |
104 | 104 | } |
105 | - return new JsonResponse(['message' => 'Not authorized'], 403); |
|
105 | + return new JsonResponse([ 'message' => 'Not authorized' ], 403); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -19,7 +19,7 @@ |
||
19 | 19 | public function process(ServerRequestInterface $request, DelegateInterface $delegate) |
20 | 20 | { |
21 | 21 | $capsule = new Manager; |
22 | - $capsule->addConnection($request->getAttribute('config')['database']); |
|
22 | + $capsule->addConnection($request->getAttribute('config')[ 'database' ]); |
|
23 | 23 | $capsule->setAsGlobal(); |
24 | 24 | $capsule->bootEloquent(); |
25 | 25 | return $delegate->process($request->withAttribute('capsule', $capsule)); |