Nette\PhpGenerator\ClassType::addTrait PHP Метод

addTrait() публичный Метод

public addTrait ( $trait ) : self
Результат self
    public function addTrait($trait)
    {
        $this->traits[] = (string) $trait;
        return $this;
    }

Usage Example

Пример #1
0
 private function addTrait($trait, $typesReference)
 {
     $traitFull = $trait;
     if (array_key_exists($trait, $typesReference)) {
         $traitNamespace = $typesReference[$trait];
         $traitFull = $traitNamespace . '\\' . $trait;
     }
     $this->currentClass->getNamespace()->addUse($traitFull);
     $this->currentClass->addTrait($traitFull);
     $this->info('Add trait', ['class' => $this->currentClass->getName(), 'trait' => $traitFull]);
 }
All Usage Examples Of Nette\PhpGenerator\ClassType::addTrait