Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
    • Reflection
    • Security
    • Templating
    • Utils
  • NetteModule
  • none
  • Tracy
    • Bridges
      • Nette

Classes

  • ContainerPanel
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (http://nette.org)
 5:  * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
 6:  */
 7: 
 8: namespace Nette\Bridges\DITracy;
 9: 
10: use Nette,
11:     Nette\DI\Container,
12:     Tracy;
13: 
14: 
15: /**
16:  * Dependency injection container panel for Debugger Bar.
17:  *
18:  * @author     Patrik Votoček
19:  */
20: class ContainerPanel extends Nette\Object implements Tracy\IBarPanel
21: {
22:     /** @var int */
23:     public static $compilationTime;
24: 
25:     /** @var Nette\DI\Container */
26:     private $container;
27: 
28:     /** @var int|NULL */
29:     private $elapsedTime;
30: 
31: 
32:     public function __construct(Container $container)
33:     {
34:         $this->container = $container;
35:         $this->elapsedTime = self::$compilationTime ? microtime(TRUE) - self::$compilationTime : NULL;
36:     }
37: 
38: 
39:     /**
40:      * Renders tab.
41:      * @return string
42:      */
43:     public function getTab()
44:     {
45:         ob_start();
46:         $elapsedTime = $this->elapsedTime;
47:         require __DIR__ . '/templates/ContainerPanel.tab.phtml';
48:         return ob_get_clean();
49:     }
50: 
51: 
52:     /**
53:      * Renders panel.
54:      * @return string
55:      */
56:     public function getPanel()
57:     {
58:         $container = $this->container;
59:         $registry = $this->getContainerProperty('registry');
60:         $rc = new \ReflectionClass($container);
61:         $file = $rc->getFileName();
62:         $tags = array();
63:         $meta = $this->getContainerProperty('meta');
64:         $services = $meta[Container::SERVICES];
65:         ksort($services);
66:         if (isset($meta[Container::TAGS])) {
67:             foreach ($meta[Container::TAGS] as $tag => $tmp) {
68:                 foreach ($tmp as $service => $val) {
69:                     $tags[$service][$tag] = $val;
70:                 }
71:             }
72:         }
73: 
74:         ob_start();
75:         require __DIR__ . '/templates/ContainerPanel.panel.phtml';
76:         return ob_get_clean();
77:     }
78: 
79: 
80:     private function getContainerProperty($name)
81:     {
82:         $rc = new \ReflectionClass('Nette\DI\Container');
83:         $prop = $rc->getProperty($name);
84:         $prop->setAccessible(TRUE);
85:         return $prop->getValue($this->container);
86:     }
87: 
88: }
89: 
Nette 2.3.1 API API documentation generated by ApiGen 2.8.0