public function getTraitByName($name)
    {
        $variables = [];
        foreach ($this->collection as $trait) {
            if (\is_array($name)) {
                $variables = \reset($name);
                $name = \key($name);
            }
            /** @var $trait TraitDefinition */
            if ($trait->getName() === $name) {
                return $trait->parseVariables($variables);
            }
        }

        throw new Exception(\sprintf('No trait found for name %s, list: %s', \var_export($name, true), \var_export($this->collection, true)));
    }
public function getTraitByName($name)
    {
        $variables = [];
        foreach ($this->collection as $trait) {
            if (\is_array($name)) {
                $variables = \reset($name);
                $name = \key($name);
            }
            /** @var $trait TraitDefinition */
            if ($trait->getName() === $name) {
                return $trait->parseVariables($variables);
            }
        }

        throw new Exception(\sprintf('No trait found for name %s, list: %s', \var_export($name, true), \var_export($this->collection, true)));
    }
public function getTraitByName ( $ name ) { $ variables = [ ] ; foreach ( $ this -> collection as $ trait ) { if ( \ is_array ( $ name ) ) { $ variables = \ reset ( $ name ) ; $ name = \ key ( $ name ) ; } /** @var $trait TraitDefinition */ if ( $ trait -> getName ( ) === $ name ) { return $ trait -> parseVariables ( $ variables ) ; } } throw new Exception ( \ sprintf ( 'No trait found for name %s, list: %s' , \ var_export ( $ name , true ) , \ var_export ( $ this -> collection , true ) ) ) ; }
Retrieves a trait by name

@param string $name Name of the Trait to retrieve.

@return TraitDefinition Returns Trait matching given name if found.
@throws Exception When no type is found.
Retrieves a trait by name