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

tempestphp / tempest-framework / 11319238494

13 Oct 2024 12:13PM UTC coverage: 82.008% (-0.09%) from 82.1%
11319238494

push

github

web-flow
fix: view argument casing (#585)

4 of 4 new or added lines in 1 file covered. (100.0%)

30 existing lines in 5 files now uncovered.

6764 of 8248 relevant lines covered (82.01%)

39.93 hits per line

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

0.0
/src/Tempest/Support/src/VarExport/VarExportPhpFile.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest\Support\VarExport;
6

7
use Symfony\Component\VarExporter\VarExporter;
8

9
/**
10
 * A wrapper around a PHP file to export variables to. This enables us to take advantage of OPcache file cache.
11
 *
12
 * @template T type of exported data
13
 */
14
final readonly class VarExportPhpFile
15
{
UNCOV
16
    public function __construct(
×
17
        public string $filename,
18
    ) {
UNCOV
19
        if ($this->filename === '') {
×
20
            throw new EmptyFileNameException("Filename MUST NOT be empty!");
×
21
        }
22
    }
23

UNCOV
24
    public function exists(): bool
×
25
    {
UNCOV
26
        return file_exists($this->filename);
×
27
    }
28

29
    /**
30
     * @return T
31
     */
UNCOV
32
    public function import(): mixed
×
33
    {
UNCOV
34
        if (! $this->exists()) {
×
35
            throw new FileDoesNotExistException("The required VarExport File does not exist!");
×
36
        }
37

UNCOV
38
        return require $this->filename;
×
39
    }
40

41
    /**
42
     * @param T $data
43
     */
UNCOV
44
    public function export(mixed $data): void
×
45
    {
UNCOV
46
        $serializedData = VarExporter::export($data);
×
47

UNCOV
48
        $phpFileContent = <<<PHP
×
UNCOV
49
<?php // cache file generated by tempest. Do not edit manually.
×
UNCOV
50
return {$serializedData};
×
UNCOV
51
PHP;
×
52

UNCOV
53
        file_put_contents($this->filename, $phpFileContent, LOCK_EX);
×
54
    }
55

56
    public function destroy(): void
×
57
    {
58
        @unlink($this->filename);
×
59
    }
60
}
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