Skip to content

Commit 7da2670

Browse files
committed
refactor: throw directly ResourceAlreadyExistsException instead of ClassAlreadyExistsException
1 parent a9f66c3 commit 7da2670

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/Exceptions/ResourceAlreadyExistsException.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,13 @@ public function __construct(
1212
) {
1313
$entity = $this->getEntity();
1414

15-
$filePath = $this->getFilePath();
16-
17-
parent::__construct("Cannot create {$entity} cause it already exists. Remove {$filePath} and run command again.");
15+
parent::__construct("Cannot create {$entity} cause it already exists. Remove {$this->$filePath} and run command again.");
1816
}
1917

2018
protected function getEntity(): string
2119
{
22-
$entity = Str::afterLast($this->filePath, '/');
23-
24-
return Str::before($entity, '.php');
25-
}
26-
27-
protected function getFilePath(): string
28-
{
29-
$filePath = realpath($this->filePath);
20+
$fileName = Str::afterLast($this->filePath, '/');
3021

31-
return empty($filePath) ? $this->filePath : "{$filePath}:1";
22+
return Str::before($fileName, '.php');
3223
}
3324
}

0 commit comments

Comments
 (0)