Passed
Branch master (ffb5df)
by Michele
03:52
created
src/Middleware/WebArtisanEnabled.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     public function handle($request, Closure $next)
37 37
     {
38 38
         $response = $next($request);
39
-        if ($response instanceof Response and $this->webartisan->isEnabled() and $request->url() != asset(config('webartisan.route_prefix').'/run')) {
39
+        if ($response instanceof Response and $this->webartisan->isEnabled() and $request->url() != asset(config('webartisan.route_prefix') . '/run')) {
40 40
             try {
41 41
                 $response->getContent();
42 42
             }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
                 return $response;
45 45
             }
46 46
 
47
-            if(!$this->webartisan->useAuthentication()
47
+            if (!$this->webartisan->useAuthentication()
48 48
                 or ($this->webartisan->useAuthentication()
49 49
                     and $request->session()->has('webartisan__authenticated'))) {
50 50
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,7 @@
 block discarded – undo
39 39
         if ($response instanceof Response and $this->webartisan->isEnabled() and $request->url() != asset(config('webartisan.route_prefix').'/run')) {
40 40
             try {
41 41
                 $response->getContent();
42
-            }
43
-            catch (\ErrorException $e) {
42
+            } catch (\ErrorException $e) {
44 43
                 return $response;
45 44
             }
46 45
 
Please login to merge, or discard this patch.
src/LaravelWebArtisan.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
      *
40 40
      * @param null $app
41 41
      */
42
-	public function __construct($app = null)
43
-	{
42
+    public function __construct($app = null)
43
+    {
44 44
         if (!$app) {
45 45
             $app = app();   //Fallback when $app is not given
46 46
         }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $this->enabled = value($this->app['config']->get('webartisan.enabled'));
50 50
         $this->use_authentication = value($this->app['config']->get('webartisan.use_authentication'));
51 51
         $this->authenticated = false;
52
-	}
52
+    }
53 53
 
54 54
     /**
55 55
      * Check if the Web Artisan is enabled
Please login to merge, or discard this patch.
src/Controllers/WebArtisanCommandController.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@
 block discarded – undo
27 27
             ? $request->get('command')
28 28
             : null;
29 29
 
30
-        if($this->command) {
30
+        if ($this->command) {
31 31
             $commandPrepared = $this->prepareCommand($this->command);
32
-            if(!config('webartisan.use_authentication')
32
+            if (!config('webartisan.use_authentication')
33 33
                 or (config('webartisan.use_authentication') and $this->webartisan->isAuthenticated())) {
34 34
                     try {
35 35
                         Artisan::call($commandPrepared);
36 36
                     }
37
-                    catch(\Exception $e) {
37
+                    catch (\Exception $e) {
38 38
                         return $this->prepareResultToHtml($e->getMessage(), 'error');
39 39
                     }
40 40
             }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,12 +33,10 @@
 block discarded – undo
33 33
                 or (config('webartisan.use_authentication') and $this->webartisan->isAuthenticated())) {
34 34
                     try {
35 35
                         Artisan::call($commandPrepared);
36
-                    }
37
-                    catch(\Exception $e) {
36
+                    } catch(\Exception $e) {
38 37
                         return $this->prepareResultToHtml($e->getMessage(), 'error');
39 38
                     }
40
-            }
41
-            else {
39
+            } else {
42 40
                 return $this->prepareResultToHtml('Please, authenticate yourself before to start using Web Artisan.', 'error');
43 41
             }
44 42
             return $this->prepareResultToHtml(Artisan::output(), 'success');
Please login to merge, or discard this patch.
src/Controllers/WebArtisanAuthController.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,12 +38,12 @@
 block discarded – undo
38 38
             ? $request->get('password')
39 39
             : null;
40 40
 
41
-        if($this->username and $this->password) {
41
+        if ($this->username and $this->password) {
42 42
             $authenticated = true;
43
-            if($this->username != config('webartisan.auth.username')) $authenticated = false;
44
-            if($this->password != config('webartisan.auth.password')) $authenticated = false;
43
+            if ($this->username != config('webartisan.auth.username')) $authenticated = false;
44
+            if ($this->password != config('webartisan.auth.password')) $authenticated = false;
45 45
 
46
-            if($authenticated) {
46
+            if ($authenticated) {
47 47
                 $request->session()->put('webartisan__authenticated', true);
48 48
                 return $this->prepareResultToHtml("Welcome", 'success');
49 49
             }
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,14 +40,19 @@
 block discarded – undo
40 40
 
41 41
         if($this->username and $this->password) {
42 42
             $authenticated = true;
43
-            if($this->username != config('webartisan.auth.username')) $authenticated = false;
44
-            if($this->password != config('webartisan.auth.password')) $authenticated = false;
43
+            if($this->username != config('webartisan.auth.username')) {
44
+                $authenticated = false;
45
+            }
46
+            if($this->password != config('webartisan.auth.password')) {
47
+                $authenticated = false;
48
+            }
45 49
 
46 50
             if($authenticated) {
47 51
                 $request->session()->put('webartisan__authenticated', true);
48 52
                 return $this->prepareResultToHtml("Welcome", 'success');
53
+            } else {
54
+                return $this->prepareResultToHtml("Oops, it looks like we don't know each other.", 'error');
49 55
             }
50
-            else return $this->prepareResultToHtml("Oops, it looks like we don't know each other.", 'error');
51 56
         }
52 57
         return $this->prepareResultToHtml("Username and Password cannot be empty.", 'error');
53 58
     }
Please login to merge, or discard this patch.