protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null)
    {
        $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context);

        $trait = new TraitElement($object->fqsen, $docBlock, new Location($object->getLine()));

        if (isset($object->stmts)) {
            foreach ($object->stmts as $stmt) {
                switch (get_class($stmt)) {
                    case PropertyNode::class:
                        $properties = new PropertyIterator($stmt);
                        foreach ($properties as $property) {
                            $element = $this->createMember($property, $strategies, $context);
                            $trait->addProperty($element);
                        }
                        break;
                    case ClassMethod::class:
                        $method = $this->createMember($stmt, $strategies, $context);
                        $trait->addMethod($method);
                        break;
                    case TraitUse::class:
                        foreach ($stmt->traits as $use) {
                            $trait->addUsedTrait(new Fqsen('\\' . $use->toString()));
                        }
                        break;
                }
            }
        }

        return $trait;
    }
protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null)
    {
        $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context);

        $trait = new TraitElement($object->fqsen, $docBlock, new Location($object->getLine()));

        if (isset($object->stmts)) {
            foreach ($object->stmts as $stmt) {
                switch (get_class($stmt)) {
                    case PropertyNode::class:
                        $properties = new PropertyIterator($stmt);
                        foreach ($properties as $property) {
                            $element = $this->createMember($property, $strategies, $context);
                            $trait->addProperty($element);
                        }
                        break;
                    case ClassMethod::class:
                        $method = $this->createMember($stmt, $strategies, $context);
                        $trait->addMethod($method);
                        break;
                    case TraitUse::class:
                        foreach ($stmt->traits as $use) {
                            $trait->addUsedTrait(new Fqsen('\\' . $use->toString()));
                        }
                        break;
                }
            }
        }

        return $trait;
    }
protected function doCreate ( $ object , StrategyContainer $ strategies , ? Context $ context = null ) { $ docBlock = $ this -> createDocBlock ( $ strategies , $ object -> getDocComment ( ) , $ context ) ; $ trait = new TraitElement ( $ object -> fqsen , $ docBlock , new Location ( $ object -> getLine ( ) ) ) ; if ( isset ( $ object -> stmts ) ) { foreach ( $ object -> stmts as $ stmt ) { switch ( get_class ( $ stmt ) ) { case PropertyNode :: class : $ properties = new PropertyIterator ( $ stmt ) ; foreach ( $ properties as $ property ) { $ element = $ this -> createMember ( $ property , $ strategies , $ context ) ; $ trait -> addProperty ( $ element ) ; } break ; case ClassMethod :: class : $ method = $ this -> createMember ( $ stmt , $ strategies , $ context ) ; $ trait -> addMethod ( $ method ) ; break ; case TraitUse :: class : foreach ( $ stmt -> traits as $ use ) { $ trait -> addUsedTrait ( new Fqsen ( '\\' . $ use -> toString ( ) ) ) ; } break ; } } } return $ trait ; }
Creates an TraitElement out of the given object.

Since an object might contain other objects that need to be converted the $factory is passed so it can be
used to create nested Elements.

@param TraitNode $object object to convert to an TraitElement
@param StrategyContainer $strategies used to convert nested objects.
@return TraitElement
Creates an TraitElement out of the given object .