Completed
Pull Request — master (#47)
by claudio
05:09
created
app/Console/Commands/Optimise/OptimiseException.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: Claudio Cardinale <[email protected]>
5
- * Date: 07/12/15
6
- * Time: 21.24
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU General Public License
9
- * as published by the Free Software Foundation; either version 2
10
- * of the License, or (at your option) any later version.
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
- * GNU General Public License for more details.
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, write to the Free Software
17
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
- */
3
+     * Created by PhpStorm.
4
+     * User: Claudio Cardinale <[email protected]>
5
+     * Date: 07/12/15
6
+     * Time: 21.24
7
+     * This program is free software; you can redistribute it and/or
8
+     * modify it under the terms of the GNU General Public License
9
+     * as published by the Free Software Foundation; either version 2
10
+     * of the License, or (at your option) any later version.
11
+     * This program is distributed in the hope that it will be useful,
12
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
+     * GNU General Public License for more details.
15
+     * You should have received a copy of the GNU General Public License
16
+     * along with this program; if not, write to the Free Software
17
+     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
+     */
19 19
 
20 20
 namespace plunner\Console\Commands\Optimise;
21 21
 
Please login to merge, or discard this patch.
app/Events/Optimise/OkEvent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,6 +39,6 @@
 block discarded – undo
39 39
      */
40 40
     public function broadcastOn()
41 41
     {
42
-        return [];
42
+        return [ ];
43 43
     }
44 44
 }
Please login to merge, or discard this patch.
app/Events/Optimise/ErrorEvent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,6 +39,6 @@
 block discarded – undo
39 39
      */
40 40
     public function broadcastOn()
41 41
     {
42
-        return [];
42
+        return [ ];
43 43
     }
44 44
 }
Please login to merge, or discard this patch.
app/Company.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @var array
50 50
      */
51
-    protected $fillable = ['name', 'email', 'password'];
51
+    protected $fillable = [ 'name', 'email', 'password' ];
52 52
 
53 53
     /**
54 54
      * The attributes excluded from the model's JSON form.
55 55
      *
56 56
      * @var array
57 57
      */
58
-    protected $hidden = ['password', 'remember_token'];
58
+    protected $hidden = [ 'password', 'remember_token' ];
59 59
 
60 60
     /**
61 61
      * @return \Illuminate\Database\Eloquent\Relations\HasMany
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
             ->where('calendars.enabled', '=', '1')
121 121
             ->where('timeslots.time_start', '>=', $from)
122 122
             ->where('timeslots.time_end', '<=', $to)
123
-            ->where('employees.company_id','=', $this->id)
124
-            ->select('employees.id','timeslots.time_start','timeslots.time_end')
123
+            ->where('employees.company_id', '=', $this->id)
124
+            ->select('employees.id', 'timeslots.time_start', 'timeslots.time_end')
125 125
             ->get();
126 126
     }
127 127
 
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
             ->join('meeting_timeslots', 'meetings.id', '=', 'meeting_timeslots.meeting_id')
138 138
             ->where('meeting_timeslots.time_start', '>=', $from)
139 139
             ->where('meeting_timeslots.time_end', '<=', $to)
140
-            ->where('groups.company_id','=', $this->id)
141
-            ->where('meetings.start_time','=', NULL)
142
-            ->select('meetings.id', 'meetings.duration','meeting_timeslots.time_start','meeting_timeslots.time_end')
140
+            ->where('groups.company_id', '=', $this->id)
141
+            ->where('meetings.start_time', '=', NULL)
142
+            ->select('meetings.id', 'meetings.duration', 'meeting_timeslots.time_start', 'meeting_timeslots.time_end')
143 143
             ->get();
144 144
     }
145 145
 
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
             ->join('employees', 'employee_group.employee_id', '=', 'employees.id')
152 152
             ->whereIn('employees.id', $users)
153 153
             ->whereIn('meetings.id', $meetings)
154
-            ->where('groups.company_id','=', $this->id) //this is not needed
155
-            ->where('employees.company_id','=', $this->id) //this is not needed
154
+            ->where('groups.company_id', '=', $this->id) //this is not needed
155
+            ->where('employees.company_id', '=', $this->id) //this is not needed
156 156
             ->select('employees.id as employee_id', 'meetings.id as meeting_id')
157 157
             ->get();
158 158
     }
Please login to merge, or discard this patch.
app/Console/Commands/Optimise/Path.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
     {
77 77
         $path = new Path(tempnam(sys_get_temp_dir(), 'OPT')); //TODO check the return in case of errors this return false on failure
78 78
         unlink($path->getPath()); //remove file to create a dir
79
-        if(file_exists($path->getPath()))
79
+        if (file_exists($path->getPath()))
80 80
             throw new OptimiseException('problem during creation of tmp dir (the directory already exists)');
81
-        if(!@mkdir($path->getPath()))
82
-            throw new OptimiseException('problem during creation of tmp dir (mkdir problem)');;
83
-        if(! is_dir($path->getPath()))
81
+        if (!@mkdir($path->getPath()))
82
+            throw new OptimiseException('problem during creation of tmp dir (mkdir problem)'); ;
83
+        if (!is_dir($path->getPath()))
84 84
             throw new OptimiseException('problem during creation of tmp dir (it is not possible to create directory)');
85 85
         return $path;
86 86
     }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      * @return bool
92 92
      */
93 93
     private static function delTree($dir) {
94
-        $files = array_diff(scandir($dir), array('.','..'));
94
+        $files = array_diff(scandir($dir), array('.', '..'));
95 95
         foreach ($files as $file) {
96 96
             (is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file");
97 97
         }
Please login to merge, or discard this patch.
Braces   +13 added lines, -8 removed lines patch added patch discarded remove patch
@@ -48,8 +48,9 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function __destruct()
50 50
     {
51
-        if ($this->path && is_dir($this->path) && !self::delTree($this->path))
52
-            throw new OptimiseException('problems during removing of path directory');
51
+        if ($this->path && is_dir($this->path) && !self::delTree($this->path)) {
52
+                    throw new OptimiseException('problems during removing of path directory');
53
+        }
53 54
     }
54 55
 
55 56
     /**
@@ -76,12 +77,16 @@  discard block
 block discarded – undo
76 77
     {
77 78
         $path = new Path(tempnam(sys_get_temp_dir(), 'OPT')); //TODO check the return in case of errors this return false on failure
78 79
         unlink($path->getPath()); //remove file to create a dir
79
-        if(file_exists($path->getPath()))
80
-            throw new OptimiseException('problem during creation of tmp dir (the directory already exists)');
81
-        if(!@mkdir($path->getPath()))
82
-            throw new OptimiseException('problem during creation of tmp dir (mkdir problem)');;
83
-        if(! is_dir($path->getPath()))
84
-            throw new OptimiseException('problem during creation of tmp dir (it is not possible to create directory)');
80
+        if(file_exists($path->getPath())) {
81
+                    throw new OptimiseException('problem during creation of tmp dir (the directory already exists)');
82
+        }
83
+        if(!@mkdir($path->getPath())) {
84
+                    throw new OptimiseException('problem during creation of tmp dir (mkdir problem)');
85
+        }
86
+        ;
87
+        if(! is_dir($path->getPath())) {
88
+                    throw new OptimiseException('problem during creation of tmp dir (it is not possible to create directory)');
89
+        }
85 90
         return $path;
86 91
     }
87 92
 
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: Claudio Cardinale <[email protected]>
5
- * Date: 18/12/15
6
- * Time: 15.20
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU General Public License
9
- * as published by the Free Software Foundation; either version 2
10
- * of the License, or (at your option) any later version.
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
- * GNU General Public License for more details.
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, write to the Free Software
17
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
- */
3
+     * Created by PhpStorm.
4
+     * User: Claudio Cardinale <[email protected]>
5
+     * Date: 18/12/15
6
+     * Time: 15.20
7
+     * This program is free software; you can redistribute it and/or
8
+     * modify it under the terms of the GNU General Public License
9
+     * as published by the Free Software Foundation; either version 2
10
+     * of the License, or (at your option) any later version.
11
+     * This program is distributed in the hope that it will be useful,
12
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
+     * GNU General Public License for more details.
15
+     * You should have received a copy of the GNU General Public License
16
+     * along with this program; if not, write to the Free Software
17
+     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
+     */
19 19
 
20 20
 namespace plunner\Console\Commands\Optimise;
21 21
 
Please login to merge, or discard this patch.
app/Http/Middleware/GetUserAndRefresh.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: Claudio Cardinale <[email protected]>
5
- * Date: 24/12/15
6
- * Time: 22.53
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU General Public License
9
- * as published by the Free Software Foundation; either version 2
10
- * of the License, or (at your option) any later version.
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
- * GNU General Public License for more details.
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, write to the Free Software
17
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
- */
3
+     * Created by PhpStorm.
4
+     * User: Claudio Cardinale <[email protected]>
5
+     * Date: 24/12/15
6
+     * Time: 22.53
7
+     * This program is free software; you can redistribute it and/or
8
+     * modify it under the terms of the GNU General Public License
9
+     * as published by the Free Software Foundation; either version 2
10
+     * of the License, or (at your option) any later version.
11
+     * This program is distributed in the hope that it will be useful,
12
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
+     * GNU General Public License for more details.
15
+     * You should have received a copy of the GNU General Public License
16
+     * along with this program; if not, write to the Free Software
17
+     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
+     */
19 19
 
20 20
 namespace plunner\Http\Middleware;
21 21
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,15 +25,15 @@
 block discarded – undo
25 25
     public function handle($request, \Closure $next, $custom = '')
26 26
     {
27 27
         $remember = false;
28
-        if($this->auth->setRequest($request)->getToken() && ($remember = $this->auth->getPayload()->get('remember')) &&
29
-                $remember == 'true'){
28
+        if ($this->auth->setRequest($request)->getToken() && ($remember = $this->auth->getPayload()->get('remember')) &&
29
+                $remember == 'true') {
30 30
             JWTFactory::setTTL(43200);
31 31
             //config(['jwt.ttl' =>'43200']); //30 days
32 32
         }
33 33
 
34 34
         //this to add the remember me mode field in the new token, but we have the custom check that is an useless
35 35
         //overhead
36
-        $custom = $custom.';remember-'.$remember=='true'?'true':'false';
36
+        $custom = $custom.';remember-'.$remember == 'true' ? 'true' : 'false';
37 37
         return parent::handle($request, $next, $custom);
38 38
     }
39 39
 
Please login to merge, or discard this patch.
app/Http/Kernel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,6 +30,6 @@
 block discarded – undo
30 30
         'auth' => \plunner\Http\Middleware\Authenticate::class,
31 31
         'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
32 32
         'guest' => \plunner\Http\Middleware\RedirectIfAuthenticated::class,
33
-        'jwt.authandrefresh' =>  \plunner\Http\Middleware\GetUserAndRefresh::class,//'Tymon\JWTAuth\Middleware\GetUserAndRefresh',
33
+        'jwt.authandrefresh' =>  \plunner\Http\Middleware\GetUserAndRefresh::class, //'Tymon\JWTAuth\Middleware\GetUserAndRefresh',
34 34
     ];
35 35
 }
Please login to merge, or discard this patch.
app/Http/Controllers/Companies/Company/CompanyController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
 {
11 11
     public function __construct()
12 12
     {
13
-        config(['auth.model' => \plunner\Company::class]);
14
-        config(['jwt.user' => \plunner\Company::class]);
13
+        config([ 'auth.model' => \plunner\Company::class ]);
14
+        config([ 'jwt.user' => \plunner\Company::class ]);
15 15
         $this->middleware('jwt.authandrefresh:mode-cn');
16 16
     }
17 17
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     public function update(CompanyRequest $request)
37 37
     {
38 38
         $company = \Auth::user();
39
-        $input = $request->only(['name', 'password']);
39
+        $input = $request->only([ 'name', 'password' ]);
40 40
         $company->update($input);
41 41
         return $company;
42 42
     }
Please login to merge, or discard this patch.
app/Http/routes.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -18,41 +18,41 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * Companies
20 20
  */
21
-Route::group(['namespace' => 'Companies', 'prefix' => 'companies'], function() {
21
+Route::group([ 'namespace' => 'Companies', 'prefix' => 'companies' ], function() {
22 22
 
23 23
     //\Auth
24 24
 
25
-    Route::group(['namespace' => 'Auth'], function() {
26
-        Route::group(['prefix' => 'auth'], function () {
25
+    Route::group([ 'namespace' => 'Auth' ], function() {
26
+        Route::group([ 'prefix' => 'auth' ], function() {
27 27
             // Authentication routes...
28
-            Route::post('login', ['as' => 'companies.auth.login','uses'=>'AuthController@postLogin']);
28
+            Route::post('login', [ 'as' => 'companies.auth.login', 'uses'=>'AuthController@postLogin' ]);
29 29
 
30 30
             // Registration routes...
31
-            Route::post('register', ['as' => 'companies.auth.register', 'uses'=>'AuthController@postRegister']);
31
+            Route::post('register', [ 'as' => 'companies.auth.register', 'uses'=>'AuthController@postRegister' ]);
32 32
 
33 33
         });
34 34
 
35
-        Route::group(['prefix' => 'password'], function () {
35
+        Route::group([ 'prefix' => 'password' ], function() {
36 36
             // Password reset link request routes...
37
-            Route::post('email', ['as' => 'companies.auth.email', 'uses'=>'PasswordController@postEmail']);
37
+            Route::post('email', [ 'as' => 'companies.auth.email', 'uses'=>'PasswordController@postEmail' ]);
38 38
 
39 39
             // Password reset routes...
40
-            Route::post('reset', ['as' => 'companies.auth.reset', 'uses'=>'PasswordController@postReset']);
40
+            Route::post('reset', [ 'as' => 'companies.auth.reset', 'uses'=>'PasswordController@postReset' ]);
41 41
         });
42 42
     });
43 43
 
44
-    Route::group(['namespace' => 'Employees'], function() {
45
-        Route::resource('employees', 'EmployeesController', ['except' => ['create', 'edit']]);
44
+    Route::group([ 'namespace' => 'Employees' ], function() {
45
+        Route::resource('employees', 'EmployeesController', [ 'except' => [ 'create', 'edit' ] ]);
46 46
     });
47 47
 
48
-    Route::group(['namespace' => 'Groups'], function() {
49
-        Route::resource('groups', 'GroupsController', ['except' => ['create', 'edit']]);
50
-        Route::resource('groups.employees', 'EmployeesController', ['only' => ['store', 'index', 'destroy']]);
48
+    Route::group([ 'namespace' => 'Groups' ], function() {
49
+        Route::resource('groups', 'GroupsController', [ 'except' => [ 'create', 'edit' ] ]);
50
+        Route::resource('groups.employees', 'EmployeesController', [ 'only' => [ 'store', 'index', 'destroy' ] ]);
51 51
     });
52 52
 
53
-    Route::group(['namespace' => 'Company', 'prefix' => 'company'], function() {
54
-        Route::get('/', ['as' => 'companies.company.index', 'uses' => 'CompanyController@index']);
55
-        Route::put('/', ['as' => 'companies.company.update', 'uses' => 'CompanyController@update']);
53
+    Route::group([ 'namespace' => 'Company', 'prefix' => 'company' ], function() {
54
+        Route::get('/', [ 'as' => 'companies.company.index', 'uses' => 'CompanyController@index' ]);
55
+        Route::put('/', [ 'as' => 'companies.company.update', 'uses' => 'CompanyController@update' ]);
56 56
     });
57 57
 });
58 58
 
@@ -60,44 +60,44 @@  discard block
 block discarded – undo
60 60
 /**
61 61
  * Employees
62 62
  */
63
-Route::group(['namespace' => 'Employees', 'prefix' => 'employees'], function() {
63
+Route::group([ 'namespace' => 'Employees', 'prefix' => 'employees' ], function() {
64 64
 
65 65
     //\Auth
66
-    Route::group(['namespace' => 'Auth'], function() {
67
-        Route::group(['prefix' => 'auth'], function () {
66
+    Route::group([ 'namespace' => 'Auth' ], function() {
67
+        Route::group([ 'prefix' => 'auth' ], function() {
68 68
             // Authentication routes...
69
-            Route::post('login', ['as' => 'companies.auth.login', 'uses'=>'AuthController@postLogin']);
69
+            Route::post('login', [ 'as' => 'companies.auth.login', 'uses'=>'AuthController@postLogin' ]);
70 70
 
71 71
             // Registration routes...
72 72
             //Route::post('register', ['as' => 'companies.auth.register', 'uses'=>'AuthController@postRegister']); //the registration is managed by the company
73 73
 
74 74
         });
75 75
 
76
-        Route::group(['prefix' => 'password'], function () {
76
+        Route::group([ 'prefix' => 'password' ], function() {
77 77
             // Password reset link request routes...
78
-            Route::post('email', ['as' => 'companies.auth.email', 'uses'=>'PasswordController@postEmail']);
78
+            Route::post('email', [ 'as' => 'companies.auth.email', 'uses'=>'PasswordController@postEmail' ]);
79 79
 
80 80
             // Password reset routes...
81
-            Route::post('reset', ['as' => 'companies.auth.reset', 'uses'=>'PasswordController@postReset']);
81
+            Route::post('reset', [ 'as' => 'companies.auth.reset', 'uses'=>'PasswordController@postReset' ]);
82 82
         });
83 83
     });
84 84
 
85
-    Route::group(['namespace' => 'Calendars'], function() {
86
-        Route::resource('calendars', 'CalendarsController', ['except' => ['create', 'edit']]);
87
-        Route::post('calendars/caldav', ['as' => 'employees.calendars.caldav','uses'=>'CalendarsController@storeCaldav']);
88
-        Route::post('calendars/calendars', ['as' => 'employees.calendars.calendars','uses'=>'CalendarsController@getCalendars']); //TODO it's correct post? or not
85
+    Route::group([ 'namespace' => 'Calendars' ], function() {
86
+        Route::resource('calendars', 'CalendarsController', [ 'except' => [ 'create', 'edit' ] ]);
87
+        Route::post('calendars/caldav', [ 'as' => 'employees.calendars.caldav', 'uses'=>'CalendarsController@storeCaldav' ]);
88
+        Route::post('calendars/calendars', [ 'as' => 'employees.calendars.calendars', 'uses'=>'CalendarsController@getCalendars' ]); //TODO it's correct post? or not
89 89
     });
90 90
 
91
-    Route::group(['namespace' => 'Planners', 'prefix' => 'planners'], function() {
92
-        Route::resource('groups', 'GroupsController', ['only' => ['index', 'show']]);
91
+    Route::group([ 'namespace' => 'Planners', 'prefix' => 'planners' ], function() {
92
+        Route::resource('groups', 'GroupsController', [ 'only' => [ 'index', 'show' ] ]);
93 93
     });
94 94
 
95
-    Route::group(['namespace' => 'Groups'], function() {
96
-        Route::resource('groups', 'GroupsController', ['only' => ['index', 'show']]);
95
+    Route::group([ 'namespace' => 'Groups' ], function() {
96
+        Route::resource('groups', 'GroupsController', [ 'only' => [ 'index', 'show' ] ]);
97 97
     });
98 98
 
99
-    Route::group(['namespace' => 'Employee', 'prefix' => 'employee'], function() {
100
-        Route::get('/', ['as' => 'employees.employee.index', 'uses' => 'EmployeeController@index']);
101
-        Route::put('/', ['as' => 'employees.employee.update', 'uses' => 'EmployeeController@update']);
99
+    Route::group([ 'namespace' => 'Employee', 'prefix' => 'employee' ], function() {
100
+        Route::get('/', [ 'as' => 'employees.employee.index', 'uses' => 'EmployeeController@index' ]);
101
+        Route::put('/', [ 'as' => 'employees.employee.update', 'uses' => 'EmployeeController@update' ]);
102 102
     });
103 103
 });
104 104
\ No newline at end of file
Please login to merge, or discard this patch.