public function addTrait($trait) {
		if ($trait instanceof PhpTrait) {
			$name = $trait->getName();
			$qname = $trait->getQualifiedName();
			$namespace = $trait->getNamespace();

			if ($namespace != $this->getNamespace()) {
				$this->addUseStatement($qname);
			}
		} else {
			$name = $trait;
		}

		if (!in_array($name, $this->traits)) {
			$this->traits[] = $name;
		}

		return $this;
	}
public function addTrait($trait) {
		if ($trait instanceof PhpTrait) {
			$name = $trait->getName();
			$qname = $trait->getQualifiedName();
			$namespace = $trait->getNamespace();

			if ($namespace != $this->getNamespace()) {
				$this->addUseStatement($qname);
			}
		} else {
			$name = $trait;
		}

		if (!in_array($name, $this->traits)) {
			$this->traits[] = $name;
		}

		return $this;
	}
public function addTrait ( $ trait ) { if ( $ trait instanceof PhpTrait ) { $ name = $ trait -> getName ( ) ; $ qname = $ trait -> getQualifiedName ( ) ; $ namespace = $ trait -> getNamespace ( ) ; if ( $ namespace != $ this -> getNamespace ( ) ) { $ this -> addUseStatement ( $ qname ) ; } } else { $ name = $ trait ; } if ( ! in_array ( $ name , $ this -> traits ) ) { $ this -> traits [ ] = $ name ; } return $ this ; }
Adds a trait.

If the trait is passed as PhpTrait object,
the trait is also added as use statement.

@param PhpTrait|string $trait trait or qualified name
@return $this
Adds a trait .