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

tempestphp / tempest-framework / 14024978163

23 Mar 2025 05:55PM UTC coverage: 79.391% (-0.05%) from 79.441%
14024978163

push

github

web-flow
feat(view): cache Blade and Twig templates in internal storage (#1061)

2 of 2 new or added lines in 2 files covered. (100.0%)

912 existing lines in 110 files now uncovered.

10478 of 13198 relevant lines covered (79.39%)

91.09 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 InvalidArgumentException;
8
use Nette\InvalidStateException;
9
use ReflectionException;
10
use Tempest\Generation\ClassManipulator;
11
use Tempest\Generation\Enums\StubFileType;
12

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

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

32
            return new self(
35✔
33
                filePath: $pathOrClass,
35✔
34
                type: StubFileType::CLASS_FILE,
35✔
35
            );
35✔
36
        } catch (InvalidStateException|ReflectionException) {
13✔
37
            if (! file_exists($pathOrClass)) {
13✔
UNCOV
38
                throw new InvalidArgumentException(sprintf('The file "%s" does not exist.', $pathOrClass));
×
39
            }
40

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