Passed
Pull Request — master (#9)
by George
04:12
created
src/Scaffold.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 
30 30
     public static function make($migrationName)
31 31
     {
32
-        $scaffold =  new Scaffold($migrationName);
32
+        $scaffold = new Scaffold($migrationName);
33 33
         $scaffold->files = new Filesystem();
34 34
         $scaffold->files->requireOnce($migrationName);
35 35
         $migrationInstance = $scaffold->resolve($name = $scaffold->getMigrationName($migrationName)); //parse into instance
36
-        $reflector = new \ReflectionClass($migrationInstance);  //reflect
36
+        $reflector = new \ReflectionClass($migrationInstance); //reflect
37 37
         $migrationFileName = $reflector->getFileName();
38 38
         $scaffold->migration = $scaffold->files->get($migrationFileName);
39 39
         $scaffold->model = ModelPattern::make($scaffold->migration);
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function getMigrationFiles($paths)
76 76
     {
77
-        return Collection::make($paths)->flatMap(function ($path) {
77
+        return Collection::make($paths)->flatMap(function($path) {
78 78
             return $this->files->glob($path.'/*_*.php');
79
-        })->filter()->sortBy(function ($file) {
79
+        })->filter()->sortBy(function($file) {
80 80
             return $this->getMigrationName($file);
81
-        })->values()->keyBy(function ($file) {
81
+        })->values()->keyBy(function($file) {
82 82
             return $this->getMigrationName($file);
83 83
         })->all();
84 84
     }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     protected function getStub($stub)
95 95
     {
96 96
         $stub = Str::camel($stub);
97
-        if($this->files->exists(app_path("Scaffold/stubs/$stub.stub"))) {
97
+        if ($this->files->exists(app_path("Scaffold/stubs/$stub.stub"))) {
98 98
                 return $this->files->get(app_path("Scaffold/stubs/$stub.stub"));
99 99
         } else {
100 100
             return false;
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     
111 111
     public function addRoutes()
112 112
     {
113
-        foreach(config('scaffold.routes') as $key => $route)
113
+        foreach (config('scaffold.routes') as $key => $route)
114 114
         {
115 115
             $namespace = Str::studly($key);
116 116
             $routeContent = $this->files->get($route['fileName']);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
             )));
121 121
 
122 122
 
123
-            if($key === 'web') {
123
+            if ($key === 'web') {
124 124
                 $routeString = "\n\nRoute::resource('$uri', '$namespace\\{$this->model->name}Controller')->only(['index', 'show']);";
125 125
             } else {
126 126
                 $routeString = "\n\nRoute::apiResource('$uri', '$namespace\\{$this->model->name}Controller');";
@@ -137,18 +137,18 @@  discard block
 block discarded – undo
137 137
     {
138 138
         $target = Str::camel(str_replace('build', '', $file));
139 139
         $config = config("scaffold.files.$target");
140
-        if(empty($config)) {
140
+        if (empty($config)) {
141 141
             throw new ScaffoldException("Configuration for $file not found");
142 142
         }
143
-        if(array_key_exists('dedependencies', $config)) {
144
-            foreach($config['dependencies'] as $dependency) {
143
+        if (array_key_exists('dedependencies', $config)) {
144
+            foreach ($config['dependencies'] as $dependency) {
145 145
                 $this->generate($dependency); //recursively generate dependencies
146 146
             }
147 147
         }
148 148
         $pathPrefix = $config['path'];
149 149
         $variables = ['model' => $this->model];
150 150
 
151
-        if(!empty(config("scaffold.variables"))) {
151
+        if (!empty(config("scaffold.variables"))) {
152 152
             foreach (config("scaffold.variables") as $variable => $value) {
153 153
                 $variables[$variable] = $this->compileVariable($value);
154 154
             }
@@ -156,17 +156,17 @@  discard block
 block discarded – undo
156 156
 
157 157
         $fileName = Vibro::compileFileName($config['fileNamePattern'], $variables);
158 158
         $pathPrefix = base_path(Vibro::compileFileName("$pathPrefix", $variables));
159
-        if($this->files->exists("$pathPrefix/$fileName")) {
159
+        if ($this->files->exists("$pathPrefix/$fileName")) {
160 160
             $this->messages[] = "File '$fileName' exists and was not overwritten.";
161 161
             return $this;
162 162
         }
163 163
 
164
-        if(!$this->files->isDirectory($pathPrefix)) {
164
+        if (!$this->files->isDirectory($pathPrefix)) {
165 165
             $this->files->makeDirectory("$pathPrefix");
166 166
         }
167 167
 
168 168
         $content = $this->build($target, $variables);
169
-        if($content) {
169
+        if ($content) {
170 170
             $this->files->put("$pathPrefix/$fileName", $content);
171 171
             $this->created[] = "$pathPrefix/$fileName";
172 172
         } else {
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     public function compileVariable($string) {
181 181
         $model = $this->model;
182 182
         ob_start();
183
-        eval( "echo $string;");
183
+        eval("echo $string;");
184 184
         $output = ob_get_contents();
185 185
         ob_end_clean();
186 186
 
Please login to merge, or discard this patch.
src/ColumnPattern.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@
 block discarded – undo
16 16
     public $config;
17 17
 
18 18
     public static function make(string $name, string $type) {
19
-        $column  = new ColumnPattern();
19
+        $column = new ColumnPattern();
20 20
         $column->name = $name;
21 21
         $column->type = $type;
22
-        if(!empty(config("scaffold.columnTypes.$type"))) {
23
-            foreach(config("scaffold.columnTypes.$type") as $key => $value) {
22
+        if (!empty(config("scaffold.columnTypes.$type"))) {
23
+            foreach (config("scaffold.columnTypes.$type") as $key => $value) {
24 24
                 $key = str_replace('"', "", $key);
25 25
                 $column->{$key} = $value;
26 26
             }
Please login to merge, or discard this patch.
src/Providers/ServiceProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@  discard block
 block discarded – undo
7 7
 
8 8
 class ServiceProvider extends \Illuminate\Support\ServiceProvider
9 9
 {
10
-    const CONFIG_PATH = __DIR__ . './../../config/scaffold.php';
10
+    const CONFIG_PATH = __DIR__.'./../../config/scaffold.php';
11 11
 
12 12
     public function boot()
13 13
     {
14
-        Code::addExtension('stub',  'vibro');
14
+        Code::addExtension('stub', 'vibro');
15 15
         $this->publishes([
16 16
             self::CONFIG_PATH => config_path('scaffold.php'),
17 17
         ], 'config');
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
             ]);
23 23
         }
24 24
         $this->publishes([
25
-            realpath(__DIR__ . '/../stubs') => app_path('Scaffold/stubs')
25
+            realpath(__DIR__.'/../stubs') => app_path('Scaffold/stubs')
26 26
         ], 'Scaffold Stubs');
27 27
     }
28 28
     public function register()
Please login to merge, or discard this patch.
src/Console/Commands/ScaffoldGenerate.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
             $scaffold = Scaffold::make($migration);
77 77
             $file = $files[$key];
78 78
             $scaffold->generate($key);
79
-            if(!empty($file['dependencies'])) {
80
-                foreach($file['dependencies'] as $dependency)
79
+            if (!empty($file['dependencies'])) {
80
+                foreach ($file['dependencies'] as $dependency)
81 81
                 {
82 82
                     $scaffold->generate($dependency);
83 83
                 }
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
             
86 86
             $scaffold->addRoutes();
87 87
 
88
-            foreach($scaffold->created as $created) {
88
+            foreach ($scaffold->created as $created) {
89 89
                 $this->info("File '$created' generated.");
90 90
             }
91
-            foreach($scaffold->messages as $message) {
91
+            foreach ($scaffold->messages as $message) {
92 92
                 $this->comment($message);
93 93
             }
94 94
             $this->line("------------------------------------------------------------------------------------------------------------------");
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
         $files = $finder->files()
103 103
             ->name('*table.php')
104 104
             ->notName('2014*')
105
-            ->in(database_path() . '/migrations');
105
+            ->in(database_path().'/migrations');
106 106
 
107 107
         foreach ($files as $file) {
108
-            $this->migrations[] = $file->getRealPath() ;
108
+            $this->migrations[] = $file->getRealPath();
109 109
         }
110 110
     }
111 111
 }
Please login to merge, or discard this patch.