Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Commit 562a962

Browse files
committed
make use of exists method
1 parent 459ce2e commit 562a962

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/Commands/FeatureDeleteCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function fire()
5959
$service = studly_case($this->argument('service'));
6060
$title = $this->parseName($this->argument('feature'));
6161

62-
if (!file_exists($feature = $this->findFeaturePath($service, $title))) {
62+
if (!$this->exists($feature = $this->findFeaturePath($service, $title))) {
6363
$this->error('Feature class '.$title.' cannot be found.');
6464
} else {
6565
$this->deleteFile($feature);

src/Commands/JobDeleteCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function fire()
5959
$domain = studly_case($this->argument('domain'));
6060
$title = $this->parseName($this->argument('job'));
6161

62-
if (!file_exists($job = $this->findJobPath($domain, $title))) {
62+
if (!$this->exists($job = $this->findJobPath($domain, $title))) {
6363
$this->error('Job class '.$title.' cannot be found.');
6464
} else {
6565
$this->deleteFile($job);

src/Commands/ServiceDeleteCommand.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,15 @@ public function fire()
7474
try {
7575
$name = ucfirst($this->argument('name'));
7676

77-
$this->deleteDirectory($this->findServicePath($name));
77+
if (!$this->exists($service = $this->findServicePath($name))) {
78+
$this->error('Service '.$name.' cannot be found.');
79+
} else {
80+
$this->deleteDirectory($service);
7881

79-
$this->info('Service <comment>'.$name.'</comment> deleted successfully.'."\n");
82+
$this->info('Service <comment>'.$name.'</comment> deleted successfully.'."\n");
8083

81-
$this->info('Please remove your registered service providers, if any.');
84+
$this->info('Please remove your registered service providers, if any.');
85+
}
8286
} catch (\Exception $e) {
8387
dd($e->getMessage(), $e->getFile(), $e->getLine());
8488
}

0 commit comments

Comments
 (0)