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

ICanBoogie / bind-symfony-dependency-injection / 6305576766

25 Sep 2023 10:29PM UTC coverage: 57.143% (-9.5%) from 66.667%
6305576766

push

github

olvlvl
Tidy

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

20 of 35 relevant lines covered (57.14%)

0.69 hits per line

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

0.0
/src/ContainerPathname.php
1
<?php
2

3
/*
4
 * This file is part of the ICanBoogie package.
5
 *
6
 * (c) Olivier Laviale <olivier.laviale@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
namespace ICanBoogie\Binding\SymfonyDependencyInjection;
13

14
use ICanBoogie\Application;
15
use RuntimeException;
16
use Stringable;
17

18
use function dirname;
19
use function file_exists;
20
use function is_writeable;
21

22
/**
23
 * Represents of a container pathname.
24
 */
25
final class ContainerPathname implements Stringable
26
{
27
    private const FILENAME = 'container-compiled.php';
28

29
    public static function from(Application $app): self
30
    {
31
        return new self($app->config->var_cache . self::FILENAME);
×
32
    }
33

34
    private function __construct(
35
        private readonly string $pathname
36
    ) {
37
    }
×
38

39
    public function __toString(): string
40
    {
41
        return $this->pathname;
×
42
    }
43

44
    public function assert_writeable(): void
45
    {
46
        $dir = dirname($this->pathname);
×
47

48
        if (!file_exists($dir)) {
×
49
            throw new RuntimeException("The directory '$dir' does not exist");
×
50
        }
51

52
        if (!is_writeable($dir)) {
×
53
            throw new RuntimeException("The directory '$dir' is not writeable");
×
54
        }
55
    }
56
}
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