Nette\PhpGenerator\ClassType::setExtends PHP Method

setExtends() public method

public setExtends ( $types ) : self
return self
    public function setExtends($types)
    {
        if (!is_string($types) && !(is_array($types) && array_filter($types, 'is_string') === $types)) {
            throw new Nette\InvalidArgumentException('Argument must be string or string[].');
        }
        $this->extends = $types;
        return $this;
    }

Usage Example

Example #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]);
     }
 }
All Usage Examples Of Nette\PhpGenerator\ClassType::setExtends