Skip to content

Commit b145dcc

Browse files
committed
fix: remarks from reviewer
1 parent 91937a7 commit b145dcc

12 files changed

+13
-13
lines changed

src/Generators/ControllerGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ControllerGenerator extends EntityGenerator
1010
{
1111
public function generate(): void
1212
{
13-
$this->throwIfResourceExists('controllers', "{$this->model}Controller");
13+
$this->checkResourceExists('controllers', "{$this->model}Controller");
1414

1515
if (!$this->classExists('services', "{$this->model}Service")) {
1616
$this->throwFailureException(

src/Generators/EntityGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ protected function pathToNamespace(string $name): string
310310
return ucwords(Str::replace('/', '\\', $name), '\\');
311311
}
312312

313-
protected function throwIfResourceExists(string $path, string $resourceName, ?string $subFolder = null): void
313+
protected function checkResourceExists(string $path, string $resourceName, ?string $subFolder = null): void
314314
{
315315
if ($this->classExists($path, $resourceName, $subFolder)) {
316316
$filePath = $this->getClassPath($path, $resourceName, $subFolder);

src/Generators/FactoryGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function generate(): void
3535
);
3636
}
3737

38-
$this->throwIfResourceExists('factories', "{$this->model}Factory");
38+
$this->checkResourceExists('factories', "{$this->model}Factory");
3939

4040
if (!$this->isStubExists('factory')) {
4141
return;

src/Generators/ModelGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ModelGenerator extends EntityGenerator
1616

1717
public function generate(): void
1818
{
19-
$this->throwIfResourceExists('models', $this->model, $this->modelSubFolder);
19+
$this->checkResourceExists('models', $this->model, $this->modelSubFolder);
2020

2121
if ($this->isStubExists('model') && (!$this->hasRelations() || $this->isStubExists('relation', 'model'))) {
2222
$this->createNamespace('models', $this->modelSubFolder);

src/Generators/NovaResourceGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function generate(): void
6363
);
6464
}
6565

66-
$this->throwIfResourceExists('nova', "{$this->model}Resource", $this->modelSubFolder);
66+
$this->checkResourceExists('nova', "{$this->model}Resource", $this->modelSubFolder);
6767

6868
if (!$this->isStubExists('nova_resource')) {
6969
return;

src/Generators/NovaTestGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class NovaTestGenerator extends AbstractTestsGenerator
2020
public function generate(): void
2121
{
2222
if (class_exists(NovaServiceProvider::class)) {
23-
$this->throwIfResourceExists('nova', "Nova{$this->model}ResourceTest");
23+
$this->checkResourceExists('nova', "Nova{$this->model}ResourceTest");
2424

2525
$novaResources = $this->getCommonNovaResources();
2626

src/Generators/RepositoryGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function generate(): void
1818
);
1919
}
2020

21-
$this->throwIfResourceExists('repositories', "{$this->model}Repository");
21+
$this->checkResourceExists('repositories', "{$this->model}Repository");
2222

2323
if (!$this->isStubExists('repository')) {
2424
return;

src/Generators/RequestsGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function createRequest($method, $needToValidate = true, $parameters =
6767
$requestsFolder = $this->model;
6868
$modelName = $this->getEntityName($method);
6969

70-
$this->throwIfResourceExists('requests', "{$requestsFolder}/{$method}{$modelName}Request");
70+
$this->checkResourceExists('requests', "{$requestsFolder}/{$method}{$modelName}Request");
7171

7272
$content = $this->getStub('request', [
7373
'method' => $method,

src/Generators/ResourceGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function generateCollectionResource(): void
2424
{
2525
$pluralName = $this->getPluralName($this->model);
2626

27-
$this->throwIfResourceExists('resources', "{$this->model}/{$pluralName}CollectionResource");
27+
$this->checkResourceExists('resources', "{$this->model}/{$pluralName}CollectionResource");
2828

2929
$collectionResourceContent = $this->getStub('collection_resource', [
3030
'singular_name' => $this->model,
@@ -39,7 +39,7 @@ public function generateCollectionResource(): void
3939

4040
public function generateResource(): void
4141
{
42-
$this->throwIfResourceExists('resources', "{$this->model}/{$this->model}Resource");
42+
$this->checkResourceExists('resources', "{$this->model}/{$this->model}Resource");
4343

4444
$resourceContent = $this->getStub('resource', [
4545
'entity' => $this->model,

src/Generators/SeederGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct()
2020

2121
public function generate(): void
2222
{
23-
$this->throwIfResourceExists('seeders', "{$this->model}Seeder");
23+
$this->checkResourceExists('seeders', "{$this->model}Seeder");
2424

2525
if (!$this->isStubExists('seeder') || !$this->isStubExists('database_empty_seeder')) {
2626
return;

0 commit comments

Comments
 (0)