public function getComposingElements($className = ''){

        $returnValue = array();
        if($className === ''){
            $className = 'oat\taoQtiItem\model\qti\Element';
        }

        $reflection = new ReflectionClass($this);
        foreach($reflection->getProperties() as $property){
            if(!$property->isStatic() && !$property->isPrivate()){
                $propertyName = $property->getName();
                if($propertyName != 'relatedItem'){
                    $value = $this->$propertyName;
                    if(is_array($value)){
                        foreach ($value as $subvalue) {
                            if($subvalue instanceof Element){
                                if($subvalue instanceof $className){
                                    $returnValue[$subvalue->getSerial()] = $subvalue;
                                }
                                $returnValue = array_merge($returnValue, $subvalue->getComposingElements($className));
                            }
                        }
                    }else{
                        if($value instanceof Element){
                            if($value instanceof $className){
                                if($value->getSerial() != $this->getSerial()){
                                    $returnValue[$value->getSerial()] = $value;
                                }
                            }
                            $returnValue = array_merge($returnValue, $value->getComposingElements($className));
                        }
                    }
                }
            }
        }

        return $returnValue;
    }
public function getComposingElements($className = ''){

        $returnValue = array();
        if($className === ''){
            $className = 'oat\taoQtiItem\model\qti\Element';
        }

        $reflection = new ReflectionClass($this);
        foreach($reflection->getProperties() as $property){
            if(!$property->isStatic() && !$property->isPrivate()){
                $propertyName = $property->getName();
                if($propertyName != 'relatedItem'){
                    $value = $this->$propertyName;
                    if(is_array($value)){
                        foreach ($value as $subvalue) {
                            if($subvalue instanceof Element){
                                if($subvalue instanceof $className){
                                    $returnValue[$subvalue->getSerial()] = $subvalue;
                                }
                                $returnValue = array_merge($returnValue, $subvalue->getComposingElements($className));
                            }
                        }
                    }else{
                        if($value instanceof Element){
                            if($value instanceof $className){
                                if($value->getSerial() != $this->getSerial()){
                                    $returnValue[$value->getSerial()] = $value;
                                }
                            }
                            $returnValue = array_merge($returnValue, $value->getComposingElements($className));
                        }
                    }
                }
            }
        }

        return $returnValue;
    }
public function getComposingElements ( $ className = '' ) { $ returnValue = array ( ) ; if ( $ className === '' ) { $ className = 'oat\taoQtiItem\model\qti\Element' ; } $ reflection = new ReflectionClass ( $ this ) ; foreach ( $ reflection -> getProperties ( ) as $ property ) { if ( ! $ property -> isStatic ( ) && ! $ property -> isPrivate ( ) ) { $ propertyName = $ property -> getName ( ) ; if ( $ propertyName != 'relatedItem' ) { $ value = $ this -> $ propertyName ; if ( is_array ( $ value ) ) { foreach ( $ value as $ subvalue ) { if ( $ subvalue instanceof Element ) { if ( $ subvalue instanceof $ className ) { $ returnValue [ $ subvalue -> getSerial ( ) ] = $ subvalue ; } $ returnValue = array_merge ( $ returnValue , $ subvalue -> getComposingElements ( $ className ) ) ; } } } else { if ( $ value instanceof Element ) { if ( $ value instanceof $ className ) { if ( $ value -> getSerial ( ) != $ this -> getSerial ( ) ) { $ returnValue [ $ value -> getSerial ( ) ] = $ value ; } } $ returnValue = array_merge ( $ returnValue , $ value -> getComposingElements ( $ className ) ) ; } } } } } return $ returnValue ; }
Recursively get all Qti Elements contained within the current Qti Element

@param string $className
@return array
Recursively get all Qti Elements contained within the current Qti Element