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

tempestphp / tempest-framework / 11800557345

12 Nov 2024 03:33PM UTC coverage: 82.436% (-0.02%) from 82.455%
11800557345

Pull #647

github

web-flow
Merge b39c42cf3 into d599d5047
Pull Request #647: feat(console): add `make:controller` and `make:model` commands

175 of 213 new or added lines in 12 files covered. (82.16%)

19 existing lines in 2 files now uncovered.

7425 of 9007 relevant lines covered (82.44%)

51.71 hits per line

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

93.33
/src/Tempest/Generation/src/DataObjects/StubFile.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest\Generation\DataObjects;
6

7
use Exception;
8
use Nette\InvalidStateException;
9
use Tempest\Generation\ClassManipulator;
10
use Tempest\Generation\Enums\StubFileType;
11

12
/**
13
 * Represents a file that is to be generated.
14
 */
15
final class StubFile
16
{
17
    public function __construct(
9✔
18
        public readonly string $filePath,
19
        public readonly StubFileType $type,
20
    ) {
21
    }
9✔
22

23
    /**
24
     * @param string|class-string $pathOrClass The path of the file or the class-string
25
     */
26
    public static function from(string $pathOrClass): self
9✔
27
    {
28
        try {
29
            new ClassManipulator($pathOrClass);
9✔
30

31
            return new self(
8✔
32
                filePath: $pathOrClass,
8✔
33
                type: StubFileType::CLASS_FILE,
8✔
34
            );
8✔
35
        } catch (InvalidStateException) {
2✔
36
            if (! file_exists($pathOrClass)) {
2✔
NEW
37
                throw new Exception(sprintf('The file "%s" does not exist.', $pathOrClass));
×
38
            }
39

40
            return new self(
2✔
41
                filePath: $pathOrClass,
2✔
42
                type: StubFileType::RAW_FILE,
2✔
43
            );
2✔
44
        }
45
    }
46
}
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

© 2026 Coveralls, Inc