@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | extract($data); |
67 | 67 | $parsed = $this->compileString($fileName); |
68 | 68 | ob_start(); |
69 | - eval( '?>' . $parsed ); |
|
69 | + eval('?>'.$parsed); |
|
70 | 70 | $output = ob_get_contents(); |
71 | 71 | ob_end_clean(); |
72 | 72 | return $output; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $result .= is_array($token) ? $this->parseToken($token) : $token; |
101 | 101 | } |
102 | 102 | |
103 | - if (! empty($this->rawBlocks)) { |
|
103 | + if (!empty($this->rawBlocks)) { |
|
104 | 104 | $result = $this->restoreRawContent($result); |
105 | 105 | } |
106 | 106 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | protected function compileStatements($value) |
124 | 124 | { |
125 | 125 | return preg_replace_callback( |
126 | - '/\B@%(@?\w+(?:::\w+)?)([ \t]*)(\( ( (?>[^()]+) | (?3) )* \))?/x', function ($match) { |
|
126 | + '/\B@%(@?\w+(?:::\w+)?)([ \t]*)(\( ( (?>[^()]+) | (?3) )* \))?/x', function($match) { |
|
127 | 127 | return $this->compileStatement($match); |
128 | 128 | }, $value |
129 | 129 | ); |
@@ -139,7 +139,7 @@ |
||
139 | 139 | { |
140 | 140 | if (Str::contains($match[1], '@%')) { |
141 | 141 | $match[0] = isset($match[3]) ? $match[1].$match[3] : $match[1]; |
142 | - } elseif (method_exists($this, $method = 'compile'.ucfirst($match[1]))) { |
|
142 | + } elseif (method_exists($this, $method = 'compile'.ucfirst($match[1]))) { |
|
143 | 143 | $match[0] = $this->$method(Arr::get($match, 3)); |
144 | 144 | } |
145 | 145 |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | |
29 | 29 | public static function make($migrationName) |
30 | 30 | { |
31 | - $scaffold = new Scaffold($migrationName); |
|
31 | + $scaffold = new Scaffold($migrationName); |
|
32 | 32 | $scaffold->files = new Filesystem(); |
33 | 33 | $scaffold->files->requireOnce($migrationName); |
34 | 34 | $migrationInstance = $scaffold->resolve($name = $scaffold->getMigrationName($migrationName)); //parse into instance |
35 | - $reflector = new \ReflectionClass($migrationInstance); //reflect |
|
35 | + $reflector = new \ReflectionClass($migrationInstance); //reflect |
|
36 | 36 | $migrationFileName = $reflector->getFileName(); |
37 | 37 | $scaffold->migration = $scaffold->files->get($migrationFileName); |
38 | 38 | $scaffold->model = ModelPattern::make($scaffold->migration); |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function getMigrationFiles($paths) |
75 | 75 | { |
76 | - return Collection::make($paths)->flatMap(function ($path) { |
|
76 | + return Collection::make($paths)->flatMap(function($path) { |
|
77 | 77 | return $this->files->glob($path.'/*_*.php'); |
78 | - })->filter()->sortBy(function ($file) { |
|
78 | + })->filter()->sortBy(function($file) { |
|
79 | 79 | return $this->getMigrationName($file); |
80 | - })->values()->keyBy(function ($file) { |
|
80 | + })->values()->keyBy(function($file) { |
|
81 | 81 | return $this->getMigrationName($file); |
82 | 82 | })->all(); |
83 | 83 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | protected function getStub($stub) |
94 | 94 | { |
95 | 95 | $stub = Str::camel($stub); |
96 | - if($this->files->exists(app_path("Scaffold/stubs/$stub.stub"))) { |
|
96 | + if ($this->files->exists(app_path("Scaffold/stubs/$stub.stub"))) { |
|
97 | 97 | return $this->files->get(app_path("Scaffold/stubs/$stub.stub")); |
98 | 98 | } else { |
99 | 99 | return false; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | public function addRoutes() |
110 | 110 | { |
111 | - foreach(config('scaffold.routes') as $key => $route) |
|
111 | + foreach (config('scaffold.routes') as $key => $route) |
|
112 | 112 | { |
113 | 113 | $namespace = Str::studly($key); |
114 | 114 | $routeContent = $this->files->get($route['fileName']); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | ))); |
119 | 119 | |
120 | 120 | |
121 | - if($key === 'web') { |
|
121 | + if ($key === 'web') { |
|
122 | 122 | $routeString = "\n\nRoute::resource('$uri', '$namespace\\{$this->model->name}Controller')->only(['index', 'show']);"; |
123 | 123 | } else { |
124 | 124 | $routeString = "\n\nRoute::apiResource('$uri', '$namespace\\{$this->model->name}Controller');"; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $pathPrefix = $config['path']; |
139 | 139 | $variables = ['model' => $this->model]; |
140 | 140 | |
141 | - if(!empty(config("scaffold.variables"))) { |
|
141 | + if (!empty(config("scaffold.variables"))) { |
|
142 | 142 | foreach (config("scaffold.variables") as $variable => $value) { |
143 | 143 | $variables[$variable] = $this->compileVariable($value); |
144 | 144 | } |
@@ -146,19 +146,19 @@ discard block |
||
146 | 146 | |
147 | 147 | $fileName = Vibro::compileFileName($config['fileNamePattern'], $variables); |
148 | 148 | $pathPrefix = base_path(Vibro::compileFileName("$pathPrefix", $variables)); |
149 | - if($this->files->exists("$pathPrefix/$fileName")) { |
|
149 | + if ($this->files->exists("$pathPrefix/$fileName")) { |
|
150 | 150 | $this->messages[] = "File '$fileName' exists and was not overwritten."; |
151 | 151 | return $this; |
152 | 152 | } |
153 | 153 | |
154 | 154 | // dd($pathPrefix); |
155 | 155 | |
156 | - if(!$this->files->isDirectory($pathPrefix)) { |
|
156 | + if (!$this->files->isDirectory($pathPrefix)) { |
|
157 | 157 | $this->files->makeDirectory("$pathPrefix"); |
158 | 158 | } |
159 | 159 | |
160 | 160 | $content = $this->build($target, $variables); |
161 | - if($content) { |
|
161 | + if ($content) { |
|
162 | 162 | $this->files->put("$pathPrefix/$fileName", $content); |
163 | 163 | $this->created[] = "$pathPrefix/$fileName"; |
164 | 164 | } else { |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | public function compileVariable($string) { |
173 | 173 | $model = $this->model; |
174 | 174 | ob_start(); |
175 | - eval( "echo $string;"); |
|
175 | + eval("echo $string;"); |
|
176 | 176 | $output = ob_get_contents(); |
177 | 177 | ob_end_clean(); |
178 | 178 | return $output; |
@@ -68,15 +68,15 @@ discard block |
||
68 | 68 | $this->line("------------------------------------------------------------------------------------------------------------------"); |
69 | 69 | $files = config('scaffold.files'); |
70 | 70 | $scaffold = Scaffold::make($migration); |
71 | - foreach($files as $key => $file) { |
|
71 | + foreach ($files as $key => $file) { |
|
72 | 72 | $scaffold->generate($key); |
73 | 73 | } |
74 | 74 | $scaffold->addRoutes(); |
75 | 75 | |
76 | - foreach($scaffold->created as $created) { |
|
76 | + foreach ($scaffold->created as $created) { |
|
77 | 77 | $this->info("File '$created' generated."); |
78 | 78 | } |
79 | - foreach($scaffold->messages as $message) { |
|
79 | + foreach ($scaffold->messages as $message) { |
|
80 | 80 | $this->comment($message); |
81 | 81 | } |
82 | 82 | $this->line("------------------------------------------------------------------------------------------------------------------"); |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | $files = $finder->files() |
91 | 91 | ->name('*table.php') |
92 | 92 | ->notName('2014*') |
93 | - ->in(database_path() . '/migrations'); |
|
93 | + ->in(database_path().'/migrations'); |
|
94 | 94 | |
95 | 95 | foreach ($files as $file) { |
96 | - $this->migrations[] = $file->getRealPath() ; |
|
96 | + $this->migrations[] = $file->getRealPath(); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | } |
@@ -7,11 +7,11 @@ discard block |
||
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 |
||
22 | 22 | ]); |
23 | 23 | } |
24 | 24 | $this->publishes([ |
25 | - __DIR__ . './../stubs' => app_path('Scaffold/stubs') |
|
25 | + __DIR__.'./../stubs' => app_path('Scaffold/stubs') |
|
26 | 26 | ], 'Scaffold Stubs'); |
27 | 27 | } |
28 | 28 | public function register() |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | class CodeServiceProvider extends ServiceProvider |
19 | 19 | { |
20 | - const CONFIG_PATH = __DIR__ . './../../config/scaffold.php'; |
|
20 | + const CONFIG_PATH = __DIR__.'./../../config/scaffold.php'; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Register the service provider. |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function registerFactory() |
42 | 42 | { |
43 | - $this->app->singleton('code', function ($app) { |
|
43 | + $this->app->singleton('code', function($app) { |
|
44 | 44 | // Next we need to grab the engine resolver instance that will be used by the |
45 | 45 | // environment. The resolver will be used by an environment to get each of |
46 | 46 | // the various engine implementations such as plain PHP or Blade engine. |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function registerViewFinder() |
83 | 83 | { |
84 | - $this->app->bind('code.finder', function ($app) { |
|
84 | + $this->app->bind('code.finder', function($app) { |
|
85 | 85 | return new FileViewFinder($app['files'], $app['config']['view.paths']); |
86 | 86 | }); |
87 | 87 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function registerEngineResolver() |
95 | 95 | { |
96 | - $this->app->singleton('code.engine.resolver', function () { |
|
96 | + $this->app->singleton('code.engine.resolver', function() { |
|
97 | 97 | $resolver = new EngineResolver; |
98 | 98 | |
99 | 99 | // Next, we will register the various view engines with the resolver so that the |
@@ -116,13 +116,13 @@ discard block |
||
116 | 116 | // The Compiler engine requires an instance of the CompilerInterface, which in |
117 | 117 | // this case will be the Blade compiler, so we'll first create the compiler |
118 | 118 | // instance to pass into the engine so it can compile the views properly. |
119 | - $this->app->singleton('vibro.compiler', function () { |
|
119 | + $this->app->singleton('vibro.compiler', function() { |
|
120 | 120 | return new VibroCompiler( |
121 | 121 | $this->app['files'], $this->app['config']['view.compiled'] |
122 | 122 | ); |
123 | 123 | }); |
124 | 124 | |
125 | - $resolver->register('vibro', function () { |
|
125 | + $resolver->register('vibro', function() { |
|
126 | 126 | return new CodeCompilerEngine($this->app['vibro.compiler']); |
127 | 127 | }); |
128 | 128 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | class VibroServiceProvider extends ViewServiceProvider |
16 | 16 | { |
17 | - const CONFIG_PATH = __DIR__ . './../../config/scaffold.php'; |
|
17 | + const CONFIG_PATH = __DIR__.'./../../config/scaffold.php'; |
|
18 | 18 | |
19 | 19 | public function boot() |
20 | 20 | { |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | public function register() |
27 | 27 | { |
28 | - $this->app->singleton('vibro.compiler', function () { |
|
28 | + $this->app->singleton('vibro.compiler', function() { |
|
29 | 29 | return new VibroCompiler( |
30 | 30 | $this->app['files'], $this->app['config']['view.compiled'] |
31 | 31 | ); |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | ->parseColumns() |
43 | 43 | ->processColumns(); |
44 | 44 | |
45 | - $model->namespace = "App\\" . config('scaffold.files.model.path'); |
|
46 | - $model->fqname = $model->namespace . "\\" . $model->name; |
|
45 | + $model->namespace = "App\\".config('scaffold.files.model.path'); |
|
46 | + $model->fqname = $model->namespace."\\".$model->name; |
|
47 | 47 | return $model; |
48 | 48 | } |
49 | 49 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | private function processColumns() { |
80 | - foreach($this->columns as $column) { |
|
80 | + foreach ($this->columns as $column) { |
|
81 | 81 | $this->processColumn($column); |
82 | 82 | } |
83 | 83 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | public static function arrayStringify($array) |
112 | 112 | { |
113 | - if(count($array) > 0) { |
|
113 | + if (count($array) > 0) { |
|
114 | 114 | $export = str_replace(['array (', ')', '(', ')'], ['[', ']', '(', ')'], var_export($array, true)); |
115 | 115 | $export = preg_replace("/ => \n[^\S\n]*\[/m", ' => [', $export); |
116 | 116 | $export = preg_replace("/ => \[\n[^\S\n]*\]/m", ' => []', $export); |