@@ -93,14 +93,14 @@ protected function buildMethods(Controller $controller)
93
93
if (in_array ($ name , ['edit ' , 'update ' , 'show ' , 'destroy ' ])) {
94
94
$ context = Str::singular ($ controller ->prefix ());
95
95
$ reference = $ this ->fullyQualifyModelReference ($ controller ->namespace (), Str::camel ($ context ));
96
- $ variable = '$ ' . Str::camel ($ context );
96
+ $ variable = '$ ' . Str::camel ($ context );
97
97
98
98
// TODO: verify controller prefix references a model
99
99
$ search = ' * @return \\Illuminate \\Http \\Response ' ;
100
- $ method = str_replace ($ search , ' * @param \\' . $ reference. ' ' . $ variable. PHP_EOL . $ search , $ method );
100
+ $ method = str_replace ($ search , ' * @param \\' . $ reference . ' ' . $ variable . PHP_EOL . $ search , $ method );
101
101
102
102
$ search = '(Request $request ' ;
103
- $ method = str_replace ($ search , $ search. ', ' . $ context. ' ' . $ variable , $ method );
103
+ $ method = str_replace ($ search , $ search . ', ' . $ context . ' ' . $ variable , $ method );
104
104
$ this ->addImport ($ controller , $ reference );
105
105
}
106
106
@@ -109,50 +109,50 @@ protected function buildMethods(Controller $controller)
109
109
110
110
foreach ($ statements as $ statement ) {
111
111
if ($ statement instanceof SendStatement) {
112
- $ body .= self ::INDENT . $ statement ->output (). PHP_EOL ;
112
+ $ body .= self ::INDENT . $ statement ->output () . PHP_EOL ;
113
113
if ($ statement ->type () === SendStatement::TYPE_NOTIFICATION_WITH_FACADE ) {
114
114
$ this ->addImport ($ controller , 'Illuminate \\Support \\Facades \\Notification ' );
115
- $ this ->addImport ($ controller , config ('blueprint.namespace ' ). '\\Notification \\' . $ statement ->mail ());
115
+ $ this ->addImport ($ controller , config ('blueprint.namespace ' ) . '\\Notification \\' . $ statement ->mail ());
116
116
} elseif ($ statement ->type () === SendStatement::TYPE_MAIL ) {
117
117
$ this ->addImport ($ controller , 'Illuminate \\Support \\Facades \\Mail ' );
118
- $ this ->addImport ($ controller , config ('blueprint.namespace ' ). '\\Mail \\' . $ statement ->mail ());
118
+ $ this ->addImport ($ controller , config ('blueprint.namespace ' ) . '\\Mail \\' . $ statement ->mail ());
119
119
}
120
120
} elseif ($ statement instanceof ValidateStatement) {
121
121
$ using_validation = true ;
122
- $ class_name = $ controller ->name (). Str::studly ($ name ). 'Request ' ;
122
+ $ class_name = $ controller ->name () . Str::studly ($ name ) . 'Request ' ;
123
123
124
- $ fqcn = config ('blueprint.namespace ' ). '\\Http \\Requests \\' . ($ controller ->namespace () ? $ controller ->namespace (). '\\' : '' ). $ class_name ;
124
+ $ fqcn = config ('blueprint.namespace ' ) . '\\Http \\Requests \\' . ($ controller ->namespace () ? $ controller ->namespace () . '\\' : '' ) . $ class_name ;
125
125
126
- $ method = str_replace ('\Illuminate\Http\Request $request ' , '\\' . $ fqcn. ' $request ' , $ method );
127
- $ method = str_replace ('(Request $request ' , '( ' . $ class_name. ' $request ' , $ method );
126
+ $ method = str_replace ('\Illuminate\Http\Request $request ' , '\\' . $ fqcn . ' $request ' , $ method );
127
+ $ method = str_replace ('(Request $request ' , '( ' . $ class_name . ' $request ' , $ method );
128
128
129
129
$ this ->addImport ($ controller , $ fqcn );
130
130
} elseif ($ statement instanceof DispatchStatement) {
131
- $ body .= self ::INDENT . $ statement ->output (). PHP_EOL ;
132
- $ this ->addImport ($ controller , config ('blueprint.namespace ' ). '\\Jobs \\' . $ statement ->job ());
131
+ $ body .= self ::INDENT . $ statement ->output () . PHP_EOL ;
132
+ $ this ->addImport ($ controller , config ('blueprint.namespace ' ) . '\\Jobs \\' . $ statement ->job ());
133
133
} elseif ($ statement instanceof FireStatement) {
134
- $ body .= self ::INDENT . $ statement ->output (). PHP_EOL ;
134
+ $ body .= self ::INDENT . $ statement ->output () . PHP_EOL ;
135
135
if (!$ statement ->isNamedEvent ()) {
136
- $ this ->addImport ($ controller , config ('blueprint.namespace ' ). '\\Events \\' . $ statement ->event ());
136
+ $ this ->addImport ($ controller , config ('blueprint.namespace ' ) . '\\Events \\' . $ statement ->event ());
137
137
}
138
138
} elseif ($ statement instanceof RenderStatement) {
139
- $ body .= self ::INDENT . $ statement ->output (). PHP_EOL ;
139
+ $ body .= self ::INDENT . $ statement ->output () . PHP_EOL ;
140
140
} elseif ($ statement instanceof ResourceStatement) {
141
- $ fqcn = config ('blueprint.namespace ' ). '\\Http \\Resources \\' . ($ controller ->namespace () ? $ controller ->namespace (). '\\' : '' ). $ statement ->name ();
142
- $ method = str_replace ('* @return \\Illuminate \\Http \\Response ' , '* @return \\' . $ fqcn , $ method );
141
+ $ fqcn = config ('blueprint.namespace ' ) . '\\Http \\Resources \\' . ($ controller ->namespace () ? $ controller ->namespace () . '\\' : '' ) . $ statement ->name ();
142
+ $ method = str_replace ('* @return \\Illuminate \\Http \\Response ' , '* @return \\' . $ fqcn , $ method );
143
143
$ this ->addImport ($ controller , $ fqcn );
144
- $ body .= self ::INDENT . $ statement ->output (). PHP_EOL ;
144
+ $ body .= self ::INDENT . $ statement ->output () . PHP_EOL ;
145
145
} elseif ($ statement instanceof RedirectStatement) {
146
- $ body .= self ::INDENT . $ statement ->output (). PHP_EOL ;
146
+ $ body .= self ::INDENT . $ statement ->output () . PHP_EOL ;
147
147
} elseif ($ statement instanceof RespondStatement) {
148
- $ body .= self ::INDENT . $ statement ->output (). PHP_EOL ;
148
+ $ body .= self ::INDENT . $ statement ->output () . PHP_EOL ;
149
149
} elseif ($ statement instanceof SessionStatement) {
150
- $ body .= self ::INDENT . $ statement ->output (). PHP_EOL ;
150
+ $ body .= self ::INDENT . $ statement ->output () . PHP_EOL ;
151
151
} elseif ($ statement instanceof EloquentStatement) {
152
- $ body .= self ::INDENT . $ statement ->output ($ controller ->prefix (), $ name , $ using_validation ). PHP_EOL ;
152
+ $ body .= self ::INDENT . $ statement ->output ($ controller ->prefix (), $ name , $ using_validation ) . PHP_EOL ;
153
153
$ this ->addImport ($ controller , $ this ->determineModel ($ controller , $ statement ->reference ()));
154
154
} elseif ($ statement instanceof QueryStatement) {
155
- $ body .= self ::INDENT . $ statement ->output ($ controller ->prefix ()). PHP_EOL ;
155
+ $ body .= self ::INDENT . $ statement ->output ($ controller ->prefix ()) . PHP_EOL ;
156
156
$ this ->addImport ($ controller , $ this ->determineModel ($ controller , $ statement ->model ()));
157
157
}
158
158
@@ -164,10 +164,10 @@ protected function buildMethods(Controller $controller)
164
164
}
165
165
166
166
if (Blueprint::supportsReturnTypeHits ()) {
167
- $ method = str_replace (') ' . PHP_EOL , '): \Illuminate\Http\Response ' . PHP_EOL , $ method );
167
+ $ method = str_replace (') ' . PHP_EOL , '): \Illuminate\Http\Response ' . PHP_EOL , $ method );
168
168
}
169
169
170
- $ methods .= PHP_EOL . $ method ;
170
+ $ methods .= PHP_EOL . $ method ;
171
171
}
172
172
173
173
return trim ($ methods );
@@ -177,7 +177,7 @@ protected function getPath(Controller $controller)
177
177
{
178
178
$ path = str_replace ('\\' , '/ ' , Blueprint::relativeNamespace ($ controller ->fullyQualifiedClassName ()));
179
179
180
- return Blueprint::appPath (). '/ ' . $ path. '.php ' ;
180
+ return Blueprint::appPath () . '/ ' . $ path . '.php ' ;
181
181
}
182
182
183
183
protected function buildImports (Controller $ controller )
@@ -186,7 +186,7 @@ protected function buildImports(Controller $controller)
186
186
sort ($ imports );
187
187
188
188
return implode (PHP_EOL , array_map (function ($ class ) {
189
- return 'use ' . $ class. '; ' ;
189
+ return 'use ' . $ class . '; ' ;
190
190
}, $ imports ));
191
191
}
192
192
@@ -221,6 +221,6 @@ private function fullyQualifyModelReference(string $sub_namespace, string $model
221
221
return $ model ->fullyQualifiedClassName ();
222
222
}
223
223
224
- return config ('blueprint.namespace ' ). '\\' . ($ sub_namespace ? $ sub_namespace. '\\' : '' ). $ model_name ;
224
+ return config ('blueprint.namespace ' ) . '\\' . ($ sub_namespace ? $ sub_namespace . '\\' : '' ) . $ model_name ;
225
225
}
226
226
}
0 commit comments