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

contributte / tracy / #27

pending completion
#27

push

github

f3l1x
WIP: MultiLogger

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

37 of 101 relevant lines covered (36.63%)

0.37 hits per line

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

50.0
/src/ServiceBuilder.php
1
<?php declare(strict_types = 1);
2

3
namespace Contributte\Tracy;
4

5
use Nette\DI\CompilerExtension;
6
use Nette\DI\ContainerBuilder;
7
use Nette\DI\Definitions\Definition;
8
use Nette\DI\Definitions\ServiceDefinition;
9

10
class ServiceBuilder
11
{
12

13
        /** @var ContainerBuilder */
14
        private $builder;
15

16
        private function __construct(ContainerBuilder $builder)
17
        {
18
                $this->builder = $builder;
1✔
19
        }
1✔
20

21

22
        public static function of(CompilerExtension $extension): self
23
        {
24
                return new self($extension->getContainerBuilder());
1✔
25
        }
26

27
        public function getServiceDefinition(string $name): ServiceDefinition
28
        {
29
                $def = $this->builder->getDefinition($name);
1✔
30

31
                assert($def instanceof ServiceDefinition);
32

33
                return $def;
1✔
34
        }
35

36
        public function getDefinitionByType(string $name): Definition
37
        {
38
                return $this->builder->getDefinitionByType($name);
1✔
39
        }
40

41
        /**
42
         * @return array<string, ServiceDefinition>
43
         */
44
        public function findServiceDefinitionByType(string $type): array
45
        {
46
                $output = [];
×
47
                $definitions = $this->builder->findByType($type);
×
48

49
                foreach ($definitions as $key => $definition) {
×
50
                        assert($definition instanceof ServiceDefinition);
51
                        $output[$key] = $definition;
×
52
                }
53

54
                return $output;
×
55
        }
56

57
        /**
58
         * @return array<string, Definition>
59
         */
60
        public function findDefinitionByType(string $type): array
61
        {
62
                return $this->builder->findByType($type);
1✔
63
        }
64

65
        public function getServiceDefinitionByType(string $name): ServiceDefinition
66
        {
67
                $def = $this->builder->getDefinitionByType($name);
×
68

69
                assert($def instanceof ServiceDefinition);
70

71
                return $def;
×
72
        }
73

74
}
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