Completed
Pull Request — development (#237)
by Claudio
05:43 queued 02:39
created
app/Providers/ValidationServiceProvider.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
      */
19 19
     public function register()
20 20
     {
21
-        $this->app->bind('chocovalidate', function () {
21
+        $this->app->bind('chocovalidate', function() {
22 22
             return Validation::getInstance();
23 23
         });
24 24
     }
Please login to merge, or discard this patch.
Switch Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,24 +1,24 @@
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Providers;
3
+ namespace App\Providers;
4 4
 
5
-use App\Helpers\Validation;
6
-use Illuminate\Support\ServiceProvider;
5
+ use App\Helpers\Validation;
6
+ use Illuminate\Support\ServiceProvider;
7 7
 
8 8
 /**
9 9
  * Class ValidationServiceProvider.
10 10
  */
11
-class ValidationServiceProvider extends ServiceProvider
12
-{
13
-    /**
11
+ class ValidationServiceProvider extends ServiceProvider
12
+ {
13
+     /**
14 14
      * Register the Session Service Provider.
15 15
      *
16 16
      * @return void
17 17
      */
18
-    public function register()
19
-    {
20
-        $this->app->bind('chocovalidate', function () {
21
-            return Validation::getInstance();
22
-        });
23
-    }
18
+     public function register()
19
+     {
20
+         $this->app->bind('chocovalidate', function () {
21
+             return Validation::getInstance();
22
+         });
23
+     }
24 24
 }
Please login to merge, or discard this patch.
app/Http/Controllers/AccountController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             'block_friendrequests' => $request->json()->get('friendRequestEnabled') == false ? '1' : '0',
79 79
         ]);
80 80
 
81
-        foreach ((array) $request->json()->all() as $setting => $value) {
81
+        foreach ((array)$request->json()->all() as $setting => $value) {
82 82
             UserPreferences::find(UserFacade::getUser()->uniqueId)->update([$setting => $value == true ? '1' : '0']);
83 83
         }
84 84
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
         $token = Mail::store($userInfo['email'], 'public/registration/activate');
146 146
 
147
-        Mail::send(['email' => $userInfo['email'], 'name' => $userName, 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName')]);
147
+        Mail::send(['email' => $userInfo['email'], 'name' => $userName, 'url' => "/activate/{$token}", 'subject' => 'Welcome to ' . Config::get('chocolatey.hotelName')]);
148 148
 
149 149
         return UserFacade::setSession((new User())->store($userName, $userInfo['email'], $request->ip(), $newUser));
150 150
     }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     {
163 163
         $partialName = explode(' ', (new Alliteration())->getName());
164 164
 
165
-        return strtolower($partialName[0].strstr($userMail, '@', true).$partialName[1]);
165
+        return strtolower($partialName[0] . strstr($userMail, '@', true) . $partialName[1]);
166 166
     }
167 167
 
168 168
     /**
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         $token = Mail::store(UserFacade::getUser()->email, 'public/registration/activate');
212 212
 
213 213
         Mail::send(['name' => UserFacade::getUser()->name, 'email' => $request->user()->email,
214
-            'url'          => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName'),
214
+            'url'          => "/activate/{$token}", 'subject' => 'Welcome to ' . Config::get('chocolatey.hotelName'),
215 215
         ]);
216 216
 
217 217
         return response(null);
Please login to merge, or discard this patch.
app/Models/Photo.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function getIdAttribute(): string
56 56
     {
57
-        return (string) $this->attributes['id'];
57
+        return (string)$this->attributes['id'];
58 58
     }
59 59
 
60 60
     /**
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public function getLikesAttribute(): array
108 108
     {
109
-        return array_map(function (array $item) {
109
+        return array_map(function(array $item) {
110 110
             return $item['username'];
111 111
         }, PhotoLike::query()->select('username')->where('photo_id', $this->attributes['id'])->get(['username'])->toArray());
112 112
     }
Please login to merge, or discard this patch.
app/Helpers/Validation.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
      */
47 47
     public function checkWords(string $needle): bool
48 48
     {
49
-        return count(array_filter(Config::get('chocolatey.invalid'), function ($illegal) use ($needle) {
49
+        return count(array_filter(Config::get('chocolatey.invalid'), function($illegal) use ($needle) {
50 50
             return stripos($needle, $illegal) !== false;
51 51
         })) == 0;
52 52
     }
Please login to merge, or discard this patch.
Switch Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@  discard block
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Helpers;
3
+ namespace App\Helpers;
4 4
 
5
-use App\Singleton;
6
-use Illuminate\Support\Facades\Config;
5
+ use App\Singleton;
6
+ use Illuminate\Support\Facades\Config;
7 7
 
8 8
 /**
9 9
  * Class Validation.
10 10
  */
11
-final class Validation extends Singleton
12
-{
13
-    /**
11
+ final class Validation extends Singleton
12
+ {
13
+     /**
14 14
      * Filter an Username from the Invalid Names Base.
15 15
      *
16 16
      * @param string $username
17 17
      *
18 18
      * @return bool
19 19
      */
20
-    public function filterUserName(string $username): bool
21
-    {
22
-        return $this->checkSize($username, 4, 15) && $this->checkWords($username) &&
23
-            preg_match('/^[a-zA-Z0-9_\-=?!@:.$]+$/', $username);
24
-    }
20
+     public function filterUserName(string $username): bool
21
+     {
22
+         return $this->checkSize($username, 4, 15) && $this->checkWords($username) &&
23
+             preg_match('/^[a-zA-Z0-9_\-=?!@:.$]+$/', $username);
24
+     }
25 25
 
26
-    /**
26
+     /**
27 27
      * Check String Size.
28 28
      *
29 29
      * @param string $needle
@@ -32,22 +32,22 @@  discard block
 block discarded – undo
32 32
      *
33 33
      * @return bool
34 34
      */
35
-    public function checkSize(string $needle, int $min, int $max)
36
-    {
37
-        return strlen($needle) <= $max && strlen($needle) >= $min;
38
-    }
35
+     public function checkSize(string $needle, int $min, int $max)
36
+     {
37
+         return strlen($needle) <= $max && strlen($needle) >= $min;
38
+     }
39 39
 
40
-    /**
40
+     /**
41 41
      * Check for Illegal Words.
42 42
      *
43 43
      * @param string $needle
44 44
      *
45 45
      * @return bool
46 46
      */
47
-    public function checkWords(string $needle): bool
48
-    {
49
-        return count(array_filter(Config::get('chocolatey.invalid'), function ($illegal) use ($needle) {
50
-            return stripos($needle, $illegal) !== false;
51
-        })) == 0;
52
-    }
47
+     public function checkWords(string $needle): bool
48
+     {
49
+         return count(array_filter(Config::get('chocolatey.invalid'), function ($illegal) use ($needle) {
50
+             return stripos($needle, $illegal) !== false;
51
+         })) == 0;
52
+     }
53 53
 }
Please login to merge, or discard this patch.
app/Singleton.php 1 patch
Switch Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App;
3
+ namespace App;
4 4
 
5 5
 /**
6 6
  * Class Singleton.
7 7
  */
8
-abstract class Singleton
9
-{
10
-    /**
8
+ abstract class Singleton
9
+ {
10
+     /**
11 11
      * Create and return a User instance.
12 12
      *
13 13
      * @return $this
14 14
      */
15
-    public static function getInstance()
16
-    {
17
-        static $instance = null;
15
+     public static function getInstance()
16
+     {
17
+         static $instance = null;
18 18
 
19
-        if ($instance === null) {
20
-            $instance = new static();
21
-        }
19
+         if ($instance === null) {
20
+             $instance = new static();
21
+         }
22 22
 
23
-        return $instance;
24
-    }
23
+         return $instance;
24
+     }
25 25
 }
Please login to merge, or discard this patch.
app/Facades/Validation.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 Validation.
9 9
  */
10
-class Validation extends Facade
11
-{
12
-    /**
10
+ class Validation 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 'chocovalidate';
20
-    }
17
+     protected static function getFacadeAccessor()
18
+     {
19
+         return 'chocovalidate';
20
+     }
21 21
 }
Please login to merge, or discard this patch.
app/Providers/ViewServiceProvider.php 1 patch
Switch Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Providers;
3
+ namespace App\Providers;
4 4
 
5
-use App\Facades\User;
6
-use Illuminate\Support\Facades\Config;
7
-use Illuminate\Support\Facades\View;
8
-use Illuminate\Support\ServiceProvider;
5
+ use App\Facades\User;
6
+ use Illuminate\Support\Facades\Config;
7
+ use Illuminate\Support\Facades\View;
8
+ use Illuminate\Support\ServiceProvider;
9 9
 
10 10
 /**
11 11
  * Class ViewServiceProvider.
12 12
  */
13
-class ViewServiceProvider extends ServiceProvider
14
-{
15
-    /**
13
+ class ViewServiceProvider extends ServiceProvider
14
+ {
15
+     /**
16 16
      * Configures all Global Blade Variables.
17 17
      *
18 18
      * @return void
19 19
      */
20
-    public function register()
21
-    {
22
-        View::share('chocolatey', json_decode(json_encode(Config::get('chocolatey'))));
20
+     public function register()
21
+     {
22
+         View::share('chocolatey', json_decode(json_encode(Config::get('chocolatey'))));
23 23
 
24
-        View::share('user', User::getUser() ?? 'null');
24
+         View::share('user', User::getUser() ?? 'null');
25 25
 
26
-        View::share('mail', json_decode(json_encode(Config::get('mail'))));
26
+         View::share('mail', json_decode(json_encode(Config::get('mail'))));
27 27
 
28
-        View::share('maintenance', json_decode(json_encode(Config::get('maintenance'))));
29
-    }
28
+         View::share('maintenance', json_decode(json_encode(Config::get('maintenance'))));
29
+     }
30 30
 }
Please login to merge, or discard this patch.
app/Helpers/Mail.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
     public function send(array $configuration, string $view = 'habbo-web-mail.confirm-mail')
29 29
     {
30 30
         if (Config::get('mail.enable')) {
31
-            MailFacade::send($view, $configuration, function ($message) use ($configuration) {
31
+            MailFacade::send($view, $configuration, function($message) use ($configuration) {
32 32
                 $message->from(Config::get('mail.from.address'), Config::get('mail.from.name'));
33 33
                 $message->to($configuration['email'])->subject($configuration['subject']);
34 34
             });
Please login to merge, or discard this patch.
Switch Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -1,41 +1,41 @@  discard block
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Helpers;
3
+ namespace App\Helpers;
4 4
 
5
-use App\Models\Mail as MailModel;
6
-use App\Singleton;
7
-use Illuminate\Support\Facades\Config;
8
-use Illuminate\Support\Facades\Mail as MailFacade;
5
+ use App\Models\Mail as MailModel;
6
+ use App\Singleton;
7
+ use Illuminate\Support\Facades\Config;
8
+ use Illuminate\Support\Facades\Mail as MailFacade;
9 9
 
10 10
 /**
11 11
  * Class Mail.
12 12
  */
13
-final class Mail extends Singleton
14
-{
15
-    /**
13
+ final class Mail extends Singleton
14
+ {
15
+     /**
16 16
      * Stored Mail Model.
17 17
      *
18 18
      * @var MailModel
19 19
      */
20
-    protected $mailModel;
20
+     protected $mailModel;
21 21
 
22
-    /**
22
+     /**
23 23
      * Send an Email.
24 24
      *
25 25
      * @param array  $configuration
26 26
      * @param string $view
27 27
      */
28
-    public function send(array $configuration, string $view = 'habbo-web-mail.confirm-mail')
29
-    {
30
-        if (Config::get('mail.enable')) {
31
-            MailFacade::send($view, $configuration, function ($message) use ($configuration) {
32
-                $message->from(Config::get('mail.from.address'), Config::get('mail.from.name'));
33
-                $message->to($configuration['email'])->subject($configuration['subject']);
34
-            });
35
-        }
36
-    }
28
+     public function send(array $configuration, string $view = 'habbo-web-mail.confirm-mail')
29
+     {
30
+         if (Config::get('mail.enable')) {
31
+             MailFacade::send($view, $configuration, function ($message) use ($configuration) {
32
+                 $message->from(Config::get('mail.from.address'), Config::get('mail.from.name'));
33
+                 $message->to($configuration['email'])->subject($configuration['subject']);
34
+             });
35
+         }
36
+     }
37 37
 
38
-    /**
38
+     /**
39 39
      * Store an E-mail.
40 40
      *
41 41
      * @param string $email
@@ -43,72 +43,72 @@  discard block
 block discarded – undo
43 43
      *
44 44
      * @return string
45 45
      */
46
-    public function store(string $email, string $url): string
47
-    {
48
-        (new MailModel())->store($token = uniqid('HabboMail', true), $url, $email, date('Y-m-d H:i:s', time()));
46
+     public function store(string $email, string $url): string
47
+     {
48
+         (new MailModel())->store($token = uniqid('HabboMail', true), $url, $email, date('Y-m-d H:i:s', time()));
49 49
 
50
-        return $token;
51
-    }
50
+         return $token;
51
+     }
52 52
 
53
-    /**
53
+     /**
54 54
      * Return if Exists E-Mail with that Token.
55 55
      *
56 56
      * @param string $token
57 57
      *
58 58
      * @return bool
59 59
      */
60
-    public function has(string $token)
61
-    {
62
-        return $this->get($token) !== null;
63
-    }
60
+     public function has(string $token)
61
+     {
62
+         return $this->get($token) !== null;
63
+     }
64 64
 
65
-    /**
65
+     /**
66 66
      * Get an E-mail by Token.
67 67
      *
68 68
      * @param string $token
69 69
      *
70 70
      * @return MailModel
71 71
      */
72
-    public function get(string $token = '')
73
-    {
74
-        if ($this->mailModel == null && !empty($token)) {
75
-            $mailModel = MailModel::where('token', $token)->where('used', '0')->first();
72
+     public function get(string $token = '')
73
+     {
74
+         if ($this->mailModel == null && !empty($token)) {
75
+             $mailModel = MailModel::where('token', $token)->where('used', '0')->first();
76 76
 
77
-            if ($mailModel !== null) {
78
-                if (strtotime($mailModel->created_at) + (Config::get('mail.expire') * 24 * 60 * 60) >= time()) {
79
-                    $this->set($mailModel);
77
+             if ($mailModel !== null) {
78
+                 if (strtotime($mailModel->created_at) + (Config::get('mail.expire') * 24 * 60 * 60) >= time()) {
79
+                     $this->set($mailModel);
80 80
 
81
-                    $this->update(['used' => '1']);
82
-                }
83
-            }
84
-        }
81
+                     $this->update(['used' => '1']);
82
+                 }
83
+             }
84
+         }
85 85
 
86
-        return $this->mailModel;
87
-    }
86
+         return $this->mailModel;
87
+     }
88 88
 
89
-    /**
89
+     /**
90 90
      * Set Mail Model in Cache.
91 91
      *
92 92
      * @param MailModel $model
93 93
      *
94 94
      * @return MailModel
95 95
      */
96
-    public function set(MailModel $model)
97
-    {
98
-        return $this->mailModel = $model;
99
-    }
96
+     public function set(MailModel $model)
97
+     {
98
+         return $this->mailModel = $model;
99
+     }
100 100
 
101
-    /**
101
+     /**
102 102
      * Update Mail Model Data.
103 103
      *
104 104
      * @param array $parameters
105 105
      *
106 106
      * @return MailModel
107 107
      */
108
-    public function update(array $parameters)
109
-    {
110
-        $this->mailModel->update($parameters);
108
+     public function update(array $parameters)
109
+     {
110
+         $this->mailModel->update($parameters);
111 111
 
112
-        return $this->mailModel;
113
-    }
112
+         return $this->mailModel;
113
+     }
114 114
 }
Please login to merge, or discard this patch.
app/Helpers/Session.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
     /**
66 66
      * Check if a Key exists in the Session.
67 67
      *
68
-     * @param mixed $key
68
+     * @param string $key
69 69
      *
70 70
      * @return bool
71 71
      */
Please login to merge, or discard this patch.
Switch Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -1,41 +1,41 @@  discard block
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Helpers;
3
+ namespace App\Helpers;
4 4
 
5
-use App\Singleton;
5
+ use App\Singleton;
6 6
 
7 7
 /**
8 8
  * Class Session.
9 9
  */
10
-final class Session extends Singleton
11
-{
12
-    /**
10
+ final class Session extends Singleton
11
+ {
12
+     /**
13 13
      * Rename the Session ID.
14 14
      *
15 15
      * @param string $name
16 16
      */
17
-    public function rename($name)
18
-    {
19
-        session_name($name);
20
-    }
17
+     public function rename($name)
18
+     {
19
+         session_name($name);
20
+     }
21 21
 
22
-    /**
22
+     /**
23 23
      * Start Session Handler.
24 24
      */
25
-    public function start()
26
-    {
27
-        @session_start();
28
-    }
25
+     public function start()
26
+     {
27
+         @session_start();
28
+     }
29 29
 
30
-    /**
30
+     /**
31 31
      * Stop Session Handler.
32 32
      */
33
-    public function destroy()
34
-    {
35
-        @session_destroy();
36
-    }
33
+     public function destroy()
34
+     {
35
+         @session_destroy();
36
+     }
37 37
 
38
-    /**
38
+     /**
39 39
      * Store a Variable in the Session.
40 40
      *
41 41
      * @param string $key
@@ -43,46 +43,46 @@  discard block
 block discarded – undo
43 43
      *
44 44
      * @return mixed
45 45
      */
46
-    public function set($key, $value)
47
-    {
48
-        $_SESSION[$key] = $value;
46
+     public function set($key, $value)
47
+     {
48
+         $_SESSION[$key] = $value;
49 49
 
50
-        return $value;
51
-    }
50
+         return $value;
51
+     }
52 52
 
53
-    /**
53
+     /**
54 54
      * Get a Attribute Value from Session.
55 55
      *
56 56
      * @param string $key
57 57
      *
58 58
      * @return mixed
59 59
      */
60
-    public function get($key)
61
-    {
62
-        return $this->has($key) ? $_SESSION[$key] : null;
63
-    }
60
+     public function get($key)
61
+     {
62
+         return $this->has($key) ? $_SESSION[$key] : null;
63
+     }
64 64
 
65
-    /**
65
+     /**
66 66
      * Check if a Key exists in the Session.
67 67
      *
68 68
      * @param mixed $key
69 69
      *
70 70
      * @return bool
71 71
      */
72
-    public function has($key)
73
-    {
74
-        return array_key_exists($key, $_SESSION);
75
-    }
72
+     public function has($key)
73
+     {
74
+         return array_key_exists($key, $_SESSION);
75
+     }
76 76
 
77
-    /**
77
+     /**
78 78
      * Erase a Attribute from Session.
79 79
      *
80 80
      * @param string $key
81 81
      */
82
-    public function erase($key)
83
-    {
84
-        $_SESSION[$key] = null;
82
+     public function erase($key)
83
+     {
84
+         $_SESSION[$key] = null;
85 85
 
86
-        unset($_SESSION[$key]);
87
-    }
86
+         unset($_SESSION[$key]);
87
+     }
88 88
 }
Please login to merge, or discard this patch.