| @@ -30,7 +30,7 @@ | ||
| 30 | 30 | // should return either a User instance or null. You're free to obtain | 
| 31 | 31 | // the User instance via an API token or any other method necessary. | 
| 32 | 32 | |
| 33 | -        $this->app['auth']->viaRequest('api', function ($request) { | |
| 33 | +        $this->app[ 'auth' ]->viaRequest('api', function($request) { | |
| 34 | 34 |              if ($request->input('api_token')) { | 
| 35 | 35 |                  return User::where('api_token', $request->input('api_token'))->first(); | 
| 36 | 36 | } | 
| @@ -21,7 +21,7 @@ discard block | ||
| 21 | 21 |          $articleResult = $article->where("hash", $articleHash)->first(); | 
| 22 | 22 | |
| 23 | 23 |          if ($articleResult != null) { | 
| 24 | -            $articleResult["comments"] = $comment->where("articleHash", $articleHash)->orderBy("created_at")->get(); | |
| 24 | +            $articleResult[ "comments" ] = $comment->where("articleHash", $articleHash)->orderBy("created_at")->get(); | |
| 25 | 25 | |
| 26 | 26 | return FormatHelper::formatData($articleResult); | 
| 27 | 27 |          } else { | 
| @@ -112,19 +112,19 @@ discard block | ||
| 112 | 112 | $dataArray = array(); | 
| 113 | 113 | |
| 114 | 114 |          if ($authorName != null) { | 
| 115 | - $dataArray["authorName"] = $authorName; | |
| 115 | + $dataArray[ "authorName" ] = $authorName; | |
| 116 | 116 | } | 
| 117 | 117 | |
| 118 | 118 |          if ($authorMail != null) { | 
| 119 | - $dataArray["authorMail"] = $authorMail; | |
| 119 | + $dataArray[ "authorMail" ] = $authorMail; | |
| 120 | 120 | } | 
| 121 | 121 | |
| 122 | 122 |          if ($title != null) { | 
| 123 | - $dataArray["title"] = $title; | |
| 123 | + $dataArray[ "title" ] = $title; | |
| 124 | 124 | } | 
| 125 | 125 | |
| 126 | 126 |          if ($content != null) { | 
| 127 | - $dataArray["content"] = $content; | |
| 127 | + $dataArray[ "content" ] = $content; | |
| 128 | 128 | } | 
| 129 | 129 | |
| 130 | 130 |          $comment->where("hash", $commentHash)->update($dataArray); | 
| @@ -40,5 +40,5 @@ | ||
| 40 | 40 | 'content' | 
| 41 | 41 | ]; | 
| 42 | 42 | |
| 43 | - protected $hidden = []; | |
| 43 | + protected $hidden = [ ]; | |
| 44 | 44 | } | 
| 45 | 45 | \ No newline at end of file | 
| @@ -37,5 +37,5 @@ | ||
| 37 | 37 | 'url' | 
| 38 | 38 | ]; | 
| 39 | 39 | |
| 40 | - protected $hidden = []; | |
| 40 | + protected $hidden = [ ]; | |
| 41 | 41 | } | 
| 42 | 42 | \ No newline at end of file | 
| @@ -32,18 +32,18 @@ | ||
| 32 | 32 |              $url = $request->input("url"); | 
| 33 | 33 | |
| 34 | 34 |              if ($name == null || $description == null || $url == null) { | 
| 35 | - $returnArray["error-code"] = "invalid-request"; | |
| 35 | + $returnArray[ "error-code" ] = "invalid-request"; | |
| 36 | 36 | $returnStatus = 400; | 
| 37 | 37 | } | 
| 38 | 38 |          } else if ($method == "PUT" && $requestPath == "/api/blog") { | 
| 39 | 39 |              $hash = $request->input("hash"); | 
| 40 | 40 |              $blogResult = $blog->where("hash", $hash)->first(); | 
| 41 | 41 |              if ($blogResult == null) { | 
| 42 | - $returnArray["error-code"] = "blog-not-found"; | |
| 42 | + $returnArray[ "error-code" ] = "blog-not-found"; | |
| 43 | 43 | $returnStatus = 404; | 
| 44 | 44 | } | 
| 45 | 45 |          } else { | 
| 46 | - $returnArray["error-code"] = "request-not-found"; | |
| 46 | + $returnArray[ "error-code" ] = "request-not-found"; | |
| 47 | 47 | $returnStatus = 400; | 
| 48 | 48 | } | 
| 49 | 49 | |
| @@ -23,15 +23,15 @@ discard block | ||
| 23 | 23 | $returnArray = array(); | 
| 24 | 24 | |
| 25 | 25 |          if (!$request->hasHeader('Authorization')) { | 
| 26 | - $returnArray["error-code"] = "authorization-header-not-found"; | |
| 26 | + $returnArray[ "error-code" ] = "authorization-header-not-found"; | |
| 27 | 27 | } | 
| 28 | 28 | |
| 29 | 29 | $token = $request->bearerToken(); | 
| 30 | 30 | |
| 31 | 31 |          if ($request->header('Authorization') == null || $token == null) { | 
| 32 | - $returnArray["error-code"] = "no-token-provided"; | |
| 32 | + $returnArray[ "error-code" ] = "no-token-provided"; | |
| 33 | 33 |          } else if (!$this->retrieveAndValidateToken($token)) { | 
| 34 | - $returnArray["error-code"] = "token-is-not-valid"; | |
| 34 | + $returnArray[ "error-code" ] = "token-is-not-valid"; | |
| 35 | 35 | } | 
| 36 | 36 | |
| 37 | 37 |          if (!empty($returnArray)) { | 
| @@ -52,9 +52,9 @@ discard block | ||
| 52 | 52 |      { | 
| 53 | 53 |          try { | 
| 54 | 54 | $verifier = new JWTVerifier([ | 
| 55 | - 'supported_algs' => ["RS256"], | |
| 56 | - 'valid_audiences' => ['https://comment.eynet.xyz/'], | |
| 57 | - 'authorized_iss' => ['https://comment-server.eu.auth0.com/'], | |
| 55 | + 'supported_algs' => [ "RS256" ], | |
| 56 | + 'valid_audiences' => [ 'https://comment.eynet.xyz/' ], | |
| 57 | + 'authorized_iss' => [ 'https://comment-server.eu.auth0.com/' ], | |
| 58 | 58 | ]); | 
| 59 | 59 | |
| 60 | 60 | $verifier->verifyAndDecode($token); | 
| @@ -37,5 +37,5 @@ | ||
| 37 | 37 | 'url' | 
| 38 | 38 | ]; | 
| 39 | 39 | |
| 40 | - protected $hidden = []; | |
| 40 | + protected $hidden = [ ]; | |
| 41 | 41 | } | 
| 42 | 42 | \ No newline at end of file | 
| @@ -54,15 +54,15 @@ | ||
| 54 | 54 | $dataArray = array(); | 
| 55 | 55 | |
| 56 | 56 |          if ($title != null) { | 
| 57 | - $dataArray["title"] = $title; | |
| 57 | + $dataArray[ "title" ] = $title; | |
| 58 | 58 | } | 
| 59 | 59 | |
| 60 | 60 |          if ($author != null) { | 
| 61 | - $dataArray["author"] = $author; | |
| 61 | + $dataArray[ "author" ] = $author; | |
| 62 | 62 | } | 
| 63 | 63 | |
| 64 | 64 |          if ($url != null) { | 
| 65 | - $dataArray["url"] = $url; | |
| 65 | + $dataArray[ "url" ] = $url; | |
| 66 | 66 | } | 
| 67 | 67 | |
| 68 | 68 |          $article->where("hash", $articleHash)->update($dataArray); | 
| @@ -73,15 +73,15 @@ | ||
| 73 | 73 | $dataArray = array(); | 
| 74 | 74 | |
| 75 | 75 |          if ($name != null) { | 
| 76 | - $dataArray["name"] = $name; | |
| 76 | + $dataArray[ "name" ] = $name; | |
| 77 | 77 | } | 
| 78 | 78 | |
| 79 | 79 |          if ($description != null) { | 
| 80 | - $dataArray["description"] = $description; | |
| 80 | + $dataArray[ "description" ] = $description; | |
| 81 | 81 | } | 
| 82 | 82 | |
| 83 | 83 |          if ($url != null) { | 
| 84 | - $dataArray["url"] = $url; | |
| 84 | + $dataArray[ "url" ] = $url; | |
| 85 | 85 | } | 
| 86 | 86 | |
| 87 | 87 |          $blog->where("hash", $blogHash)->update($dataArray); |