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

codeigniter4 / CodeIgniter4 / 25468486510

07 May 2026 12:15AM UTC coverage: 88.19% (-0.01%) from 88.204%
25468486510

Pull #10169

github

web-flow
Merge 0fd35c524 into 6c4acef98
Pull Request #10169: test: make Commands tests random-order safe

5 of 7 new or added lines in 3 files covered. (71.43%)

2 existing lines in 1 file now uncovered.

22110 of 25071 relevant lines covered (88.19%)

209.37 hits per line

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

77.78
/system/Cache/FactoriesCache/FileVarExportHandler.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of CodeIgniter 4 framework.
7
 *
8
 * (c) CodeIgniter Foundation <admin@codeigniter.com>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace CodeIgniter\Cache\FactoriesCache;
15

16
final class FileVarExportHandler
17
{
18
    private string $path = WRITEPATH . 'cache';
19

20
    public function save(string $key, mixed $val): void
21
    {
22
        $val = var_export($val, true);
32✔
23

24
        if (! is_dir($this->path)) {
32✔
NEW
25
            mkdir($this->path, 0777, true);
×
26
        }
27

28
        // Write to temp file first to ensure atomicity
29
        $tmp = $this->path . "/{$key}." . uniqid('', true) . '.tmp';
32✔
30
        if (file_put_contents($tmp, '<?php return ' . $val . ';', LOCK_EX) === false) {
32✔
NEW
31
            return;
×
32
        }
33

34
        rename($tmp, $this->path . "/{$key}");
32✔
35
    }
36

37
    public function delete(string $key): void
38
    {
39
        @unlink($this->path . "/{$key}");
2✔
40
    }
41

42
    public function get(string $key): mixed
43
    {
44
        return @include $this->path . "/{$key}";
35✔
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