diff --git a/src/Console/Command/CommandGenerator.php b/src/Console/Command/CommandGenerator.php index b031630..dd36306 100644 --- a/src/Console/Command/CommandGenerator.php +++ b/src/Console/Command/CommandGenerator.php @@ -141,6 +141,9 @@ private function isFileExists(string $className) : bool if ($this->commandList === null) { $this->commandList = []; $commandDirectory = $this->commandDirectory; + if (!is_dir($commandDirectory)) { + return false; + } $lengthStart = strlen($commandDirectory) + 1; foreach (Finder::create() ->in($commandDirectory) diff --git a/src/Console/Command/ControllerGenerator.php b/src/Console/Command/ControllerGenerator.php index ba2adc3..2f43904 100644 --- a/src/Console/Command/ControllerGenerator.php +++ b/src/Console/Command/ControllerGenerator.php @@ -132,6 +132,9 @@ private function isFileExists(string $className) : bool if ($this->controllerList === null) { $this->controllerList = []; $controllerDirectory = $this->controllerDirectory; + if (!is_dir($controllerDirectory)) { + return false; + } $lengthStart = strlen($controllerDirectory) + 1; foreach (Finder::create() ->in($controllerDirectory) diff --git a/src/Console/Command/DatabaseEventGenerator.php b/src/Console/Command/DatabaseEventGenerator.php index 2ac1330..84f84a6 100644 --- a/src/Console/Command/DatabaseEventGenerator.php +++ b/src/Console/Command/DatabaseEventGenerator.php @@ -144,6 +144,9 @@ private function isFileExists(string $className) : bool if ($this->databaseEventList === null) { $this->databaseEventList = []; $databaseEventDirectory = $this->databaseEventDirectory; + if (!is_dir($databaseEventDirectory)) { + return false; + } $lengthStart = strlen($databaseEventDirectory) + 1; foreach (Finder::create() ->in($databaseEventDirectory) diff --git a/src/Console/Command/SchedulerGenerator.php b/src/Console/Command/SchedulerGenerator.php index 8f2158c..9d12f0a 100644 --- a/src/Console/Command/SchedulerGenerator.php +++ b/src/Console/Command/SchedulerGenerator.php @@ -142,6 +142,9 @@ private function isFileExists(string $className) : bool if ($this->schedulerList === null) { $this->schedulerList = []; $schedulerDirectory = $this->schedulerDirectory; + if (!is_dir($schedulerDirectory)) { + return false; + } $lengthStart = strlen($schedulerDirectory) + 1; foreach (Finder::create() ->in($schedulerDirectory) diff --git a/src/Console/Command/SeederGenerator.php b/src/Console/Command/SeederGenerator.php index 0fbc9b8..b866115 100644 --- a/src/Console/Command/SeederGenerator.php +++ b/src/Console/Command/SeederGenerator.php @@ -142,6 +142,9 @@ private function isFileExists(string $className) : bool if ($this->seederList === null) { $this->seederList = []; $seederDirectory = $this->seederDirectory; + if (!is_dir($seederDirectory)) { + return false; + } $lengthStart = strlen($seederDirectory) + 1; foreach (Finder::create() ->in($seederDirectory) @@ -367,7 +370,7 @@ function ($e) { ) ); } - return $ask; + return $ask; } ); if ($answer) { @@ -377,8 +380,6 @@ function ($e) { $status = @file_put_contents( $fileName, $this->generateSeederContent( - $name, - $named['identity'], $named['className'] ) );