Passed
Push — master ( 2b7596...dc9824 )
by Hayri Can
01:21
created
src/IpCheckerServiceProvider.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     public function register()
21 21
     {
22 22
         $this->mergeConfigFrom(
23
-            __DIR__ . '/../config/ipchecker.php', 'ipchecker'
23
+            __DIR__.'/../config/ipchecker.php', 'ipchecker'
24 24
         );
25 25
         $this->bindServices();
26 26
     }
@@ -29,12 +29,12 @@  discard block
 block discarded – undo
29 29
         $this->loadConfig();
30 30
         $this->loadRoutes();
31 31
         $this->loadViews();
32
-        if (config('ipchecker.driver') === 'db'){
32
+        if (config('ipchecker.driver') === 'db') {
33 33
             $this->loadMigrations();
34 34
         }
35 35
     }
36 36
 
37
-    public function bindServices(){
37
+    public function bindServices() {
38 38
         $driver = config('ipchecker.driver');
39 39
         switch ($driver) {
40 40
             case 'file':
@@ -47,29 +47,29 @@  discard block
 block discarded – undo
47 47
                 throw new Exception("Unsupported Driver");
48 48
                 break;
49 49
         }
50
-        $this->app->singleton(IpCheckerInterface::class,$instance);
50
+        $this->app->singleton(IpCheckerInterface::class, $instance);
51 51
 
52
-        $this->app->singleton('ipchecker', function ($app) use ($instance){
52
+        $this->app->singleton('ipchecker', function($app) use ($instance){
53 53
             return new IpChecker($app->make($instance));
54 54
         });
55 55
     }
56 56
 
57
-    public function loadConfig(){
57
+    public function loadConfig() {
58 58
         $this->publishes([
59
-            __DIR__ . '/../config/ipchecker.php' => config_path('ipchecker.php')
59
+            __DIR__.'/../config/ipchecker.php' => config_path('ipchecker.php')
60 60
         ], 'ipchecker');
61 61
     }
62 62
 
63
-    public function loadRoutes(){
64
-        $this->loadRoutesFrom(__DIR__ . '/../routes/web.php');
63
+    public function loadRoutes() {
64
+        $this->loadRoutesFrom(__DIR__.'/../routes/web.php');
65 65
     }
66 66
 
67
-    public function loadViews(){
68
-        $this->loadViewsFrom(__DIR__ . '/../resources/views', 'ipchecker');
67
+    public function loadViews() {
68
+        $this->loadViewsFrom(__DIR__.'/../resources/views', 'ipchecker');
69 69
     }
70 70
 
71
-    public function loadMigrations(){
72
-        $this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
71
+    public function loadMigrations() {
72
+        $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
73 73
     }
74 74
 
75 75
 }
76 76
\ No newline at end of file
Please login to merge, or discard this patch.
src/Http/Middleware/IpChecker.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,15 +24,15 @@
 block discarded – undo
24 24
     public function handle($request, Closure $next)
25 25
     {
26 26
         if (!in_array($request->ip(), $this->allowedIps->getIpArray())) {
27
-            if (in_array(config('ipchecker.api_middleware'),$request->route()->gatherMiddleware())){
27
+            if (in_array(config('ipchecker.api_middleware'), $request->route()->gatherMiddleware())) {
28 28
                 $return_array = config('ipchecker.api_response');
29 29
 
30
-                return response()->json($return_array,250,[],JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
30
+                return response()->json($return_array, 250, [], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
31 31
             }
32 32
 
33 33
             $message = config('ipchecker.web_response');
34 34
 
35
-            return response()->view('ipchecker::error',compact('message'));
35
+            return response()->view('ipchecker::error', compact('message'));
36 36
         }
37 37
 
38 38
         return $next($request);
Please login to merge, or discard this patch.
src/Http/Controllers/IpCheckerController.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
     public function __construct()
19 19
     {
20 20
         if (config('ipchecker.settings.auth')) {
21
-            $this->middleware(['web','auth']);
21
+            $this->middleware(['web', 'auth']);
22 22
         }
23
-        else{
23
+        else {
24 24
             $this->middleware(['web']);
25 25
         }
26 26
     }
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
     {
36 36
         $iplist = $ipchecker->getIpList();
37 37
 
38
-        if(count($iplist)>0){
38
+        if (count($iplist)>0) {
39 39
             $iplist = $iplist->sortByDesc('created_at');
40 40
         }
41 41
 
42
-        return view('ipchecker::index',compact('iplist'));
42
+        return view('ipchecker::index', compact('iplist'));
43 43
     }
44 44
 
45 45
     /**
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * @param IpCheckerInterface $ipchecker
48 48
      * @return \Illuminate\Http\RedirectResponse
49 49
      */
50
-    public function add(Request $request,IpCheckerInterface $ipchecker)
50
+    public function add(Request $request, IpCheckerInterface $ipchecker)
51 51
     {
52 52
         $request_data = $request->all();
53 53
         $request_validation = array(
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      * @param IpCheckerInterface $ipchecker
75 75
      * @return \Illuminate\Http\RedirectResponse
76 76
      */
77
-    public function delete(Request $request,IpCheckerInterface $ipchecker)
77
+    public function delete(Request $request, IpCheckerInterface $ipchecker)
78 78
     {
79 79
         $ipchecker->deleteIp($request->input('ipAddress'));
80 80
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@
 block discarded – undo
19 19
     {
20 20
         if (config('ipchecker.settings.auth')) {
21 21
             $this->middleware(['web','auth']);
22
-        }
23
-        else{
22
+        } else{
24 23
             $this->middleware(['web']);
25 24
         }
26 25
     }
Please login to merge, or discard this patch.