• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

RonasIT / laravel-entity-generator / 12026977149

26 Nov 2024 08:49AM UTC coverage: 39.655% (+0.1%) from 39.537%
12026977149

Pull #108

github

web-flow
Merge ddd257d48 into 8497bb4ef
Pull Request #108: feat: skip generation for invalid stubs

33 of 75 new or added lines in 15 files covered. (44.0%)

23 existing lines in 2 files now uncovered.

391 of 986 relevant lines covered (39.66%)

1.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Generators/RepositoryGenerator.php
1
<?php
2

3
namespace RonasIT\Support\Generators;
4

5
use RonasIT\Support\Exceptions\ClassNotExistsException;
6
use RonasIT\Support\Events\SuccessCreateMessage;
7

8
class RepositoryGenerator extends EntityGenerator
9
{
10
    public function generate(): void
11
    {
12
        if (!$this->classExists('models', $this->model)) {
×
13
            $this->throwFailureException(
×
14
                ClassNotExistsException::class,
×
15
                "Cannot create {$this->model} Model cause {$this->model} Model does not exists.",
×
16
                "Create a {$this->model} Model by himself or run command 'php artisan make:entity {$this->model} --only-model'."
×
17
            );
×
18
        }
19

NEW
20
        if (!$this->checkStubExists('repository')) {
×
NEW
21
            return;
×
22
        }
23

24
        $repositoryContent = $this->getStub('repository', [
×
25
            'entity' => $this->model,
×
26
            'namespace' => $this->getOrCreateNamespace('repositories'),
×
27
            'modelNamespace' => $this->getOrCreateNamespace('models')
×
28
        ]);
×
29

30
        $this->saveClass('repositories', "{$this->model}Repository", $repositoryContent);
×
31

32
        event(new SuccessCreateMessage("Created a new Repository: {$this->model}Repository"));
×
33
    }
34
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc