File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,7 @@ public function __construct()
155155 */
156156 public function handle ()
157157 {
158+ $ this ->validateInput ();
158159 $ this ->eventDispatcher ->listen (SuccessCreateMessage::class, $ this ->getSuccessMessageCallback ());
159160
160161 try {
@@ -175,19 +176,19 @@ protected function classExists($path, $name)
175176 return file_exists ($ classPath );
176177 }
177178
178- protected function generate ()
179+ protected function validateInput ()
179180 {
180- foreach ($ this ->rules ['only ' ] as $ option => $ generators ) {
181-
182- if ($ this ->option ('only-api ' )) {
183- $ modelName = $ this ->argument ('name ' );
184-
185- if (!$ this ->classExists ('services ' , "{$ modelName }Service " )) {
186-
187- throw new ClassNotExistsException ('Cannot create API without entity. ' );
188- }
181+ if ($ this ->option ('only-api ' )) {
182+ $ modelName = $ this ->argument ('name ' );
183+ if (!$ this ->classExists ('services ' , "{$ modelName }Service " )) {
184+ throw new ClassNotExistsException ('Cannot create API without entity. ' );
189185 }
186+ }
187+ }
190188
189+ protected function generate ()
190+ {
191+ foreach ($ this ->rules ['only ' ] as $ option => $ generators ) {
191192 if ($ this ->option ($ option )) {
192193 foreach ($ generators as $ generator ) {
193194 $ this ->runGeneration ($ generator );
You can’t perform that action at this time.
0 commit comments