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

nette / di / 6350956765

29 Sep 2023 11:27AM UTC coverage: 93.789% (-0.4%) from 94.168%
6350956765

push

github

dg
Option 'class' is allowed again

Partially reverts commit 046f89cc3.

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

2250 of 2399 relevant lines covered (93.79%)

0.94 hits per line

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

15.63
/src/Bridges/DITracy/ContainerPanel.php
1
<?php
2

3
/**
4
 * This file is part of the Nette Framework (https://nette.org)
5
 * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6
 */
7

8
declare(strict_types=1);
9

10
namespace Nette\Bridges\DITracy;
11

12
use Nette;
13
use Nette\DI\Container;
14
use Tracy;
15

16

17
/**
18
 * Dependency injection container panel for Debugger Bar.
19
 */
20
class ContainerPanel implements Tracy\IBarPanel
21
{
22
        use Nette\SmartObject;
23

24
        /** @var float|null */
25
        public static $compilationTime;
26

27
        /** @var Nette\DI\Container */
28
        private $container;
29

30
        /** @var float|null */
31
        private $elapsedTime;
32

33

34
        public function __construct(Container $container)
1✔
35
        {
36
                $this->container = $container;
1✔
37
                $this->elapsedTime = self::$compilationTime
1✔
38
                        ? microtime(true) - self::$compilationTime
1✔
39
                        : null;
×
40
        }
1✔
41

42

43
        /**
44
         * Renders tab.
45
         */
46
        public function getTab(): string
47
        {
48
                return Nette\Utils\Helpers::capture(function () {
×
49
                        $elapsedTime = $this->elapsedTime;
×
50
                        require __DIR__ . '/templates/ContainerPanel.tab.phtml';
×
51
                });
×
52
        }
53

54

55
        /**
56
         * Renders panel.
57
         */
58
        public function getPanel(): string
59
        {
60
                $methods = (function () { return $this->methods; })->bindTo($this->container, Container::class)();
×
61
                $services = [];
×
62
                foreach ($methods as $name => $foo) {
×
63
                        $name = lcfirst(str_replace('__', '.', substr($name, 13)));
×
64
                        $services[$name] = $this->container->getServiceType($name);
×
65
                }
66
                ksort($services, SORT_NATURAL);
×
67

68
                $propertyTags = (function () { return $this->tags; })->bindTo($this->container, $this->container)();
×
69
                $tags = [];
×
70
                foreach ($propertyTags as $tag => $tmp) {
×
71
                        foreach ($tmp as $service => $val) {
×
72
                                $tags[$service][$tag] = $val;
×
73
                        }
74
                }
75

76
                return Nette\Utils\Helpers::capture(function () use ($tags, $services) {
×
77
                        $container = $this->container;
×
78
                        $rc = (new \ReflectionClass($this->container));
×
79
                        $file = $rc->getFileName();
×
80
                        $instances = (function () { return $this->instances; })->bindTo($this->container, Container::class)();
×
81
                        $wiring = (function () { return $this->wiring; })->bindTo($this->container, $this->container)();
×
82
                        $parameters = $rc->getMethod('getStaticParameters')->getDeclaringClass()->getName() === Container::class
×
83
                                ? null
×
84
                                : $container->getParameters();
×
85
                        require __DIR__ . '/templates/ContainerPanel.panel.phtml';
×
86
                });
×
87
        }
88
}
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