Наследование: implements Tracy\IBarPanel, use trait Nette\SmartObject
Пример #1
0
 public function afterCompile(Nette\PhpGenerator\ClassType $class)
 {
     if ($this->config['parentClass']) {
         $class->setExtends($this->config['parentClass']);
     }
     $initialize = $class->getMethod('initialize');
     $builder = $this->getContainerBuilder();
     if ($this->debugMode && $this->config['debugger']) {
         Nette\Bridges\DITracy\ContainerPanel::$compilationTime = $this->time;
         $initialize->addBody($builder->formatPhp('?;', [new Nette\DI\Statement('@Tracy\\Bar::addPanel', [new Nette\DI\Statement(Nette\Bridges\DITracy\ContainerPanel::class)])]));
     }
     foreach (array_filter($builder->findByTag('run')) as $name => $on) {
         $initialize->addBody('$this->getService(?);', [$name]);
     }
 }
Пример #2
0
 public function afterCompile(Nette\PhpGenerator\ClassType $class)
 {
     $initialize = $class->getMethod('initialize');
     $container = $this->getContainerBuilder();
     if ($this->debugMode && $this->config['debugger']) {
         Nette\Bridges\DITracy\ContainerPanel::$compilationTime = $this->time;
         $initialize->addBody($container->formatPhp('?;', array(new Nette\DI\Statement('@Tracy\\Bar::addPanel', array(new Nette\DI\Statement('Nette\\Bridges\\DITracy\\ContainerPanel'))))));
     }
     foreach (array_filter($container->findByTag('run')) as $name => $on) {
         $initialize->addBody('$this->getService(?);', array($name));
     }
     if (!empty($this->config['accessors'])) {
         $definitions = $container->getDefinitions();
         ksort($definitions);
         foreach ($definitions as $name => $def) {
             if (Nette\PhpGenerator\Helpers::isIdentifier($name)) {
                 $type = $def->getImplement() ?: $def->getClass();
                 $class->addDocument("@property {$type} \${$name}");
             }
         }
     }
 }