Passed
Push — master ( 59c21a...23e57e )
by Jesús
30:30 queued 28:38
created
RepositoryServiceProvider.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     {
33 33
         // merge default config
34 34
         $this->mergeConfigFrom(
35
-            __DIR__.$this->configPath , 'repositories'
35
+            __DIR__.$this->configPath, 'repositories'
36 36
         );
37 37
         
38 38
         // Bind the repositories.
@@ -50,44 +50,44 @@  discard block
 block discarded – undo
50 50
     private function autoBindRepositories()
51 51
     {
52 52
         // Load config parameters needed.
53
-        $repositoriesBasePath = config( 'repositories.repositories_path' );
54
-        $baseNamespace = rtrim( config( 'repositories.repository_interfaces_namespace' ), '\\' ) . '\\';
55
-        $skipRepositories = config( 'repositories.skip' );
56
-        $implementationBindings = config( 'repositories.bindings' );
57
-        $defaultImplementation = $this->findDefaultImplementation( $implementationBindings );
53
+        $repositoriesBasePath = config('repositories.repositories_path');
54
+        $baseNamespace = rtrim(config('repositories.repository_interfaces_namespace'), '\\').'\\';
55
+        $skipRepositories = config('repositories.skip');
56
+        $implementationBindings = config('repositories.bindings');
57
+        $defaultImplementation = $this->findDefaultImplementation($implementationBindings);
58 58
         
59
-        if ( \File::exists( $repositoriesBasePath ) )
59
+        if (\File::exists($repositoriesBasePath))
60 60
         {
61
-            $allRepos = \File::files( $repositoriesBasePath );
61
+            $allRepos = \File::files($repositoriesBasePath);
62 62
             
63
-            foreach( $allRepos as $repo )
63
+            foreach ($allRepos as $repo)
64 64
             {
65 65
                 $implementation = $defaultImplementation;
66
-                $interfaceName = pathinfo( $repo, PATHINFO_FILENAME );
67
-                if ( in_array( $interfaceName, $skipRepositories ) ) continue;
66
+                $interfaceName = pathinfo($repo, PATHINFO_FILENAME);
67
+                if (in_array($interfaceName, $skipRepositories)) continue;
68 68
                 else
69 69
                 {
70
-                    $commonName = str_replace( 'Interface', '', $interfaceName );
70
+                    $commonName = str_replace('Interface', '', $interfaceName);
71 71
                     $interfaceFullClassName = $baseNamespace.$interfaceName;
72 72
                     
73
-                    foreach( $implementationBindings as $engine => $bindRepositories )
73
+                    foreach ($implementationBindings as $engine => $bindRepositories)
74 74
                     {
75
-                        if ( $bindRepositories === 'default' ) continue;
76
-                        else if ( in_array( $interfaceName, $bindRepositories ) )
75
+                        if ($bindRepositories === 'default') continue;
76
+                        else if (in_array($interfaceName, $bindRepositories))
77 77
                         {
78 78
                             $implementation = $engine;
79 79
                             break;
80 80
                         }
81 81
                     }
82 82
                     
83
-                    $fullClassName = $baseNamespace.ucfirst( Str::camel( $implementation ) ).'\\'.$commonName;
83
+                    $fullClassName = $baseNamespace.ucfirst(Str::camel($implementation)).'\\'.$commonName;
84 84
                     
85
-                    if ( class_exists( $fullClassName ) )
85
+                    if (class_exists($fullClassName))
86 86
                     {
87 87
                         // Bind the class.
88
-                        $this->app->bind( $interfaceFullClassName, function ( $app ) use ( $fullClassName )
88
+                        $this->app->bind($interfaceFullClassName, function($app) use ($fullClassName)
89 89
                         {
90
-                            return $app->make( $fullClassName );
90
+                            return $app->make($fullClassName);
91 91
                         });
92 92
                     }
93 93
                 }
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
      * @param $implementations
101 101
      * @return array|mixed|string
102 102
      */
103
-    private function findDefaultImplementation( $implementations )
103
+    private function findDefaultImplementation($implementations)
104 104
     {
105
-        $filtered = array_filter( $implementations, function( $k ) {
105
+        $filtered = array_filter($implementations, function($k) {
106 106
             return $k === 'default';
107 107
         });
108 108
         
109 109
         $default = array_keys($filtered);
110
-        $default = is_array( $default ) ? $default[0] : $default;
110
+        $default = is_array($default) ? $default[0] : $default;
111 111
         
112 112
         return $default ? $default : 'eloquent';
113 113
     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     private function registerRepositoryGenerator()
119 119
     {
120
-        $this->app->singleton('command.repository', function ($app)
120
+        $this->app->singleton('command.repository', function($app)
121 121
         {
122 122
             return $app['OkayBueno\Repositories\Commands\MakeRepositoryCommand'];
123 123
         });
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      */
132 132
     private function registerCriteriaGenerator()
133 133
     {
134
-        $this->app->singleton('command.criteria', function ($app)
134
+        $this->app->singleton('command.criteria', function($app)
135 135
         {
136 136
             return $app['OkayBueno\Repositories\Commands\MakeCriteriaCommand'];
137 137
         });
Please login to merge, or discard this patch.