Completed
Push — development ( 686634...cf2348 )
by Claudio
04:55
created
app/Http/Controllers/ArticleController.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     protected function category(string $countryId, ArticleCategory $category, int $categoryPage, int $start): Response
57 57
     {
58
-        $articles = Article::where('id', '>=', $start)->limit(10)->orderBy('id', 'DESC')->get()->filter(function ($item) use ($category) {
58
+        $articles = Article::where('id', '>=', $start)->limit(10)->orderBy('id', 'DESC')->get()->filter(function($item) use ($category) {
59 59
             return $category->name == 'all' || in_array($category, $item->categories);
60 60
         });
61 61
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             return response()->json(null, 404);
81 81
         }
82 82
 
83
-        $related = ($latest = Article::all())->filter(function ($item) use ($article) {
83
+        $related = ($latest = Article::all())->filter(function($item) use ($article) {
84 84
             return in_array($article->categories[0], $item->categories);
85 85
         });
86 86
 
Please login to merge, or discard this patch.
Switch Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Http\Controllers;
3
+ namespace App\Http\Controllers;
4 4
 
5
-use App\Models\Article;
6
-use App\Models\ArticleCategory;
7
-use Illuminate\Http\Response;
8
-use Laravel\Lumen\Routing\Controller as BaseController;
5
+ use App\Models\Article;
6
+ use App\Models\ArticleCategory;
7
+ use Illuminate\Http\Response;
8
+ use Laravel\Lumen\Routing\Controller as BaseController;
9 9
 
10 10
 /**
11 11
  * Class ArticleController.
12 12
  */
13
-class ArticleController extends BaseController
14
-{
15
-    /**
13
+ class ArticleController extends BaseController
14
+ {
15
+     /**
16 16
      * Render a specific view of Article set.
17 17
      *
18 18
      * @param string $countryId
@@ -20,28 +20,28 @@  discard block
 block discarded – undo
20 20
      *
21 21
      * @return Response
22 22
      */
23
-    public function many(string $countryId, string $articleCategory): Response
24
-    {
25
-        $category = ArticleCategory::find(strstr(($articleCategory =
26
-            str_replace('.html', '', $articleCategory)), '_', true));
23
+     public function many(string $countryId, string $articleCategory): Response
24
+     {
25
+         $category = ArticleCategory::find(strstr(($articleCategory =
26
+             str_replace('.html', '', $articleCategory)), '_', true));
27 27
 
28
-        $categoryPage = strstr(strrev($articleCategory), '_', true);
28
+         $categoryPage = strstr(strrev($articleCategory), '_', true);
29 29
 
30
-        return $articleCategory == 'front' ? $this->front() : $this->category($countryId, $category, $categoryPage,
31
-            $categoryPage == 1 ? 0 : (10 * ($categoryPage - 1)));
32
-    }
30
+         return $articleCategory == 'front' ? $this->front() : $this->category($countryId, $category, $categoryPage,
31
+             $categoryPage == 1 ? 0 : (10 * ($categoryPage - 1)));
32
+     }
33 33
 
34
-    /**
34
+     /**
35 35
      * Render the Front Page of the Articles Page.
36 36
      *
37 37
      * @return Response
38 38
      */
39
-    protected function front(): Response
40
-    {
41
-        return response(view('habbo-web-news.articles-front', ['set' => Article::orderBy('id', 'DESC')->limit(10)->get()]));
42
-    }
39
+     protected function front(): Response
40
+     {
41
+         return response(view('habbo-web-news.articles-front', ['set' => Article::orderBy('id', 'DESC')->limit(10)->get()]));
42
+     }
43 43
 
44
-    /**
44
+     /**
45 45
      * Render a specific Category Articles Page.
46 46
      *
47 47
      * @TODO: Proper Way to use Country ID
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
      *
54 54
      * @return Response
55 55
      */
56
-    protected function category(string $countryId, ArticleCategory $category, int $categoryPage, int $start): Response
57
-    {
58
-        $articles = Article::where('id', '>=', $start)->limit(10)->orderBy('id', 'DESC')->get()->filter(function ($item) use ($category) {
59
-            return $category->name == 'all' || in_array($category, $item->categories);
60
-        });
56
+     protected function category(string $countryId, ArticleCategory $category, int $categoryPage, int $start): Response
57
+     {
58
+         $articles = Article::where('id', '>=', $start)->limit(10)->orderBy('id', 'DESC')->get()->filter(function ($item) use ($category) {
59
+             return $category->name == 'all' || in_array($category, $item->categories);
60
+         });
61 61
 
62
-        return response(view('habbo-web-news.articles-category', [
63
-            'category' => $category, 'page' => $categoryPage, 'categories' => ArticleCategory::all(), 'articles' => $articles,
64
-        ]));
65
-    }
62
+         return response(view('habbo-web-news.articles-category', [
63
+             'category' => $category, 'page' => $categoryPage, 'categories' => ArticleCategory::all(), 'articles' => $articles,
64
+         ]));
65
+     }
66 66
 
67
-    /**
67
+     /**
68 68
      * Render a specific view of a specific Article.
69 69
      *
70 70
      * @TODO: Proper Way to use Country ID
@@ -74,28 +74,28 @@  discard block
 block discarded – undo
74 74
      *
75 75
      * @return Response
76 76
      */
77
-    public function one(string $countryId, string $articleName): Response
78
-    {
79
-        if (($article = Article::find(strstr($articleName, '_', true))) == null) {
80
-            return response()->json(null, 404);
81
-        }
77
+     public function one(string $countryId, string $articleName): Response
78
+     {
79
+         if (($article = Article::find(strstr($articleName, '_', true))) == null) {
80
+             return response()->json(null, 404);
81
+         }
82 82
 
83
-        $related = ($latest = Article::all())->filter(function ($item) use ($article) {
84
-            return in_array($article->categories[0], $item->categories);
85
-        });
83
+         $related = ($latest = Article::all())->filter(function ($item) use ($article) {
84
+             return in_array($article->categories[0], $item->categories);
85
+         });
86 86
 
87
-        return response(view('habbo-web-news.articles-view',
88
-            ['article' => $article, 'latest' => $latest->slice(0, 5), 'related' => $related->slice(0, 5)]
89
-        ));
90
-    }
87
+         return response(view('habbo-web-news.articles-view',
88
+             ['article' => $article, 'latest' => $latest->slice(0, 5), 'related' => $related->slice(0, 5)]
89
+         ));
90
+     }
91 91
 
92
-    /**
92
+     /**
93 93
      * Get All Habbo Articles as XML/RSS.
94 94
      *
95 95
      * @return Response
96 96
      */
97
-    public function getRss()
98
-    {
99
-        return response(view('habbo-web-pages.habbo-rss', ['articles' => Article::limit(20)->get()]))->header('Content-Type', 'text/xml');
100
-    }
97
+     public function getRss()
98
+     {
99
+         return response(view('habbo-web-pages.habbo-rss', ['articles' => Article::limit(20)->get()]))->header('Content-Type', 'text/xml');
100
+     }
101 101
 }
Please login to merge, or discard this patch.
app/Http/Controllers/ImagingController.php 2 patches
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function getUserHead(Request $request)
27 27
     {
28
-        return redirect(Config::get('chocolatey.imaging').'avatarimage?figure='.($request->has('figure') ? $request->input('figure') :
29
-                User::where('username', $request->input('user'))->first()->figureString).'&size=l&headonly=1');
28
+        return redirect(Config::get('chocolatey.imaging') . 'avatarimage?figure=' . ($request->has('figure') ? $request->input('figure') : User::where('username', $request->input('user'))->first()->figureString) . '&size=l&headonly=1');
30 29
     }
31 30
 
32 31
     /**
@@ -39,7 +38,7 @@  discard block
 block discarded – undo
39 38
      */
40 39
     public function getUserBody(string $figure)
41 40
     {
42
-        return redirect(Config::get('chocolatey.imaging')."avatar/{$figure}");
41
+        return redirect(Config::get('chocolatey.imaging') . "avatar/{$figure}");
43 42
     }
44 43
 
45 44
     /**
Please login to merge, or discard this patch.
Switch Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  discard block
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Http\Controllers;
3
+ namespace App\Http\Controllers;
4 4
 
5
-use App\Models\EmulatorSettings;
6
-use App\Models\User;
7
-use Illuminate\Http\Request;
8
-use Illuminate\Support\Facades\Config;
9
-use Intervention\Image\Facades\Image;
10
-use Laravel\Lumen\Http\Redirector;
11
-use Laravel\Lumen\Routing\Controller as BaseController;
5
+ use App\Models\EmulatorSettings;
6
+ use App\Models\User;
7
+ use Illuminate\Http\Request;
8
+ use Illuminate\Support\Facades\Config;
9
+ use Intervention\Image\Facades\Image;
10
+ use Laravel\Lumen\Http\Redirector;
11
+ use Laravel\Lumen\Routing\Controller as BaseController;
12 12
 
13 13
 /**
14 14
  * Class ImagingController.
15 15
  */
16
-class ImagingController extends BaseController
17
-{
18
-    /**
16
+ class ImagingController extends BaseController
17
+ {
18
+     /**
19 19
      * Get User Figure for Big Header
20 20
      * based on User Name or Figure.
21 21
      *
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
      *
24 24
      * @return Redirector
25 25
      */
26
-    public function getUserHead(Request $request)
27
-    {
28
-        return redirect(Config::get('chocolatey.imaging').'avatarimage?figure='.($request->has('figure') ? $request->input('figure') :
29
-                User::where('username', $request->input('user'))->first()->figureString).'&size=l&headonly=1');
30
-    }
26
+     public function getUserHead(Request $request)
27
+     {
28
+         return redirect(Config::get('chocolatey.imaging').'avatarimage?figure='.($request->has('figure') ? $request->input('figure') :
29
+                 User::where('username', $request->input('user'))->first()->figureString).'&size=l&headonly=1');
30
+     }
31 31
 
32
-    /**
32
+     /**
33 33
      * Get User Figure for Body
34 34
      * based on User Figure.
35 35
      *
@@ -37,36 +37,36 @@  discard block
 block discarded – undo
37 37
      *
38 38
      * @return Redirector
39 39
      */
40
-    public function getUserBody(string $figure)
41
-    {
42
-        return redirect(Config::get('chocolatey.imaging')."avatar/{$figure}");
43
-    }
40
+     public function getUserBody(string $figure)
41
+     {
42
+         return redirect(Config::get('chocolatey.imaging')."avatar/{$figure}");
43
+     }
44 44
 
45
-    /**
45
+     /**
46 46
      * Get Youtube Thumbnail.
47 47
      *
48 48
      * @param Request $request
49 49
      *
50 50
      * @return string
51 51
      */
52
-    public function getYoutubeThumbnail(Request $request)
53
-    {
54
-        return Image::make($request->input('url'))->response('jpg');
55
-    }
52
+     public function getYoutubeThumbnail(Request $request)
53
+     {
54
+         return Image::make($request->input('url'))->response('jpg');
55
+     }
56 56
 
57
-    /**
57
+     /**
58 58
      * Return Group Badge.
59 59
      *
60 60
      * @param string $badgeCode
61 61
      *
62 62
      * @return mixed
63 63
      */
64
-    public function getGroupBadge(string $badgeCode)
65
-    {
66
-        $imagePath = EmulatorSettings::where('key', 'imager.location.output.badges')->first();
64
+     public function getGroupBadge(string $badgeCode)
65
+     {
66
+         $imagePath = EmulatorSettings::where('key', 'imager.location.output.badges')->first();
67 67
 
68
-        $badgeCode = str_replace('.gif', '', $badgeCode);
68
+         $badgeCode = str_replace('.gif', '', $badgeCode);
69 69
 
70
-        return Image::make("{$imagePath->value}/{$badgeCode}.png")->response('gif');
71
-    }
70
+         return Image::make("{$imagePath->value}/{$badgeCode}.png")->response('gif');
71
+     }
72 72
 }
Please login to merge, or discard this patch.
app/Helpers/User.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@
 block discarded – undo
122 122
      */
123 123
     public function hasSession()
124 124
     {
125
-        return (bool) Session::get(Config::get('chocolatey.security.session'));
125
+        return (bool)Session::get(Config::get('chocolatey.security.session'));
126 126
     }
127 127
 
128 128
     /**
Please login to merge, or discard this patch.
app/Console/Kernel.php 1 patch
Switch Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Console;
3
+ namespace App\Console;
4 4
 
5
-use Laravel\Lumen\Console\Kernel as ConsoleKernel;
5
+ use Laravel\Lumen\Console\Kernel as ConsoleKernel;
6 6
 
7
-class Kernel extends ConsoleKernel
8
-{
7
+ class Kernel extends ConsoleKernel
8
+ {
9 9
 }
Please login to merge, or discard this patch.
app/Http/Controllers/LanguageController.php 1 patch
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Http\Controllers;
3
+ namespace App\Http\Controllers;
4 4
 
5
-use Illuminate\Http\Response;
6
-use Laravel\Lumen\Routing\Controller as BaseController;
5
+ use Illuminate\Http\Response;
6
+ use Laravel\Lumen\Routing\Controller as BaseController;
7 7
 
8 8
 /**
9 9
  * Class LanguageController.
10 10
  */
11
-class LanguageController extends BaseController
12
-{
13
-    /**
11
+ class LanguageController extends BaseController
12
+ {
13
+     /**
14 14
      * Render Language View (jSON).
15 15
      *
16 16
      * @param $languageFile
17 17
      *
18 18
      * @return Response
19 19
      */
20
-    public function render($languageFile): Response
21
-    {
22
-        $languageName = strstr($languageFile, '.json', true);
20
+     public function render($languageFile): Response
21
+     {
22
+         $languageName = strstr($languageFile, '.json', true);
23 23
 
24
-        return response(view("habbo-web-l10n.{$languageName}"))->header('Content-Type', 'application/json');
25
-    }
24
+         return response(view("habbo-web-l10n.{$languageName}"))->header('Content-Type', 'application/json');
25
+     }
26 26
 }
Please login to merge, or discard this patch.
app/Http/Middleware/Authenticate.php 1 patch
Switch Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,34 +1,34 @@  discard block
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Http\Middleware;
3
+ namespace App\Http\Middleware;
4 4
 
5
-use Closure;
6
-use Illuminate\Contracts\Auth\Factory as Auth;
7
-use Illuminate\Http\Request;
5
+ use Closure;
6
+ use Illuminate\Contracts\Auth\Factory as Auth;
7
+ use Illuminate\Http\Request;
8 8
 
9 9
 /**
10 10
  * Class Authenticate.
11 11
  */
12
-class Authenticate
13
-{
14
-    /**
12
+ class Authenticate
13
+ {
14
+     /**
15 15
      * The authentication guard factory instance.
16 16
      *
17 17
      * @var Auth
18 18
      */
19
-    protected $auth;
19
+     protected $auth;
20 20
 
21
-    /**
21
+     /**
22 22
      * Create a new middleware instance.
23 23
      *
24 24
      * @param Auth $auth
25 25
      */
26
-    public function __construct(Auth $auth)
27
-    {
28
-        $this->auth = $auth;
29
-    }
26
+     public function __construct(Auth $auth)
27
+     {
28
+         $this->auth = $auth;
29
+     }
30 30
 
31
-    /**
31
+     /**
32 32
      * Handle an incoming request.
33 33
      *
34 34
      * @param Request     $request
@@ -37,16 +37,16 @@  discard block
 block discarded – undo
37 37
      *
38 38
      * @return mixed
39 39
      */
40
-    public function handle($request, Closure $next, $guard = null)
41
-    {
42
-        if ($this->auth->guard($guard)->guest()) {
43
-            return response()->json(['message' => 'authentication-needed'], 401);
44
-        }
40
+     public function handle($request, Closure $next, $guard = null)
41
+     {
42
+         if ($this->auth->guard($guard)->guest()) {
43
+             return response()->json(['message' => 'authentication-needed'], 401);
44
+         }
45 45
 
46
-        if ($request->user()->isBanned == true) {
47
-            return response('Unauthorized.', 401);
48
-        }
46
+         if ($request->user()->isBanned == true) {
47
+             return response('Unauthorized.', 401);
48
+         }
49 49
 
50
-        return $next($request);
51
-    }
50
+         return $next($request);
51
+     }
52 52
 }
Please login to merge, or discard this patch.
app/Http/Middleware/Cors.php 1 patch
Switch Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@  discard block
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Http\Middleware;
3
+ namespace App\Http\Middleware;
4 4
 
5
-use Closure;
6
-use Illuminate\Http\Request;
7
-use Illuminate\Support\Facades\Config;
5
+ use Closure;
6
+ use Illuminate\Http\Request;
7
+ use Illuminate\Support\Facades\Config;
8 8
 
9 9
 /**
10 10
  * Class Cors.
11 11
  */
12
-class Cors
13
-{
14
-    /**
12
+ class Cors
13
+ {
14
+     /**
15 15
      * Handle an incoming request.
16 16
      *
17 17
      * @param Request $request
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
      *
20 20
      * @return mixed
21 21
      */
22
-    public function handle($request, Closure $next)
23
-    {
24
-        return $next($request)
25
-            ->header('Access-Control-Allow-Origin', implode(',', Config::get('chocolatey.cors')))
26
-            ->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
27
-    }
22
+     public function handle($request, Closure $next)
23
+     {
24
+         return $next($request)
25
+             ->header('Access-Control-Allow-Origin', implode(',', Config::get('chocolatey.cors')))
26
+             ->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
27
+     }
28 28
 }
Please login to merge, or discard this patch.
app/Facades/User.php 1 patch
Switch Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Facades;
3
+ namespace App\Facades;
4 4
 
5
-use Illuminate\Support\Facades\Facade;
5
+ use Illuminate\Support\Facades\Facade;
6 6
 
7 7
 /**
8 8
  * Class User.
9 9
  */
10
-class User extends Facade
11
-{
12
-    /**
10
+ class User extends Facade
11
+ {
12
+     /**
13 13
      * Get the registered name of the component.
14 14
      *
15 15
      * @return string
16 16
      */
17
-    protected static function getFacadeAccessor()
18
-    {
19
-        return 'chocouser';
20
-    }
17
+     protected static function getFacadeAccessor()
18
+     {
19
+         return 'chocouser';
20
+     }
21 21
 }
Please login to merge, or discard this patch.
app/Facades/Mail.php 1 patch
Switch Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Facades;
3
+ namespace App\Facades;
4 4
 
5
-use Illuminate\Support\Facades\Facade;
5
+ use Illuminate\Support\Facades\Facade;
6 6
 
7 7
 /**
8 8
  * Class Mail.
9 9
  */
10
-class Mail extends Facade
11
-{
12
-    /**
10
+ class Mail extends Facade
11
+ {
12
+     /**
13 13
      * Get the registered name of the component.
14 14
      *
15 15
      * @return string
16 16
      */
17
-    protected static function getFacadeAccessor()
18
-    {
19
-        return 'chocomail';
20
-    }
17
+     protected static function getFacadeAccessor()
18
+     {
19
+         return 'chocomail';
20
+     }
21 21
 }
Please login to merge, or discard this patch.