protected function mapSingleEntity(Element $entity)
    {
        $element = new \ReflectionObject($entity);
        $properties = $element->getProperties();
        $xml = '';
        foreach ($properties as $property) {
            $propName = $property->getName();
            $propValue = $entity->$propName;
            if ($propValue !== null) {
                $xml .= '<FL val="' . str_replace(['_', 'N36', 'E5F', '&', '98T'], [' ', '$', '_', 'and', '?'], $propName) . '">';
                // It's a list of entities
                if (is_array($propValue)) {
                    $tag = null;
                    list($key, $list) = each($propValue);
                    if (!is_numeric($key)) {
                        $tag = $key;
                        $propValue = $list;
                    }
                    $xml .= $this->mapEntityList($propValue, $tag);
                }
                // It's an entity
                elseif (is_object($propValue) && (!$propValue instanceof \DateTime)) {
                    $xml .= $this->mapSingleEntity($propValue);
                }
                else {
                    $propValue = (string) $propValue;
                    // Use Character Data for non integers
                    if (!ctype_digit($propValue)) {
                       $propValue = "<![CDATA[$propValue]]>";
                    }
                    $xml .= $propValue;
                }
                $xml .= '</FL>';
            }
        }
        return $xml;
    }
protected function mapSingleEntity(Element $entity)
    {
        $element = new \ReflectionObject($entity);
        $properties = $element->getProperties();
        $xml = '';
        foreach ($properties as $property) {
            $propName = $property->getName();
            $propValue = $entity->$propName;
            if ($propValue !== null) {
                $xml .= '<FL val="' . str_replace(['_', 'N36', 'E5F', '&', '98T'], [' ', '$', '_', 'and', '?'], $propName) . '">';
                // It's a list of entities
                if (is_array($propValue)) {
                    $tag = null;
                    list($key, $list) = each($propValue);
                    if (!is_numeric($key)) {
                        $tag = $key;
                        $propValue = $list;
                    }
                    $xml .= $this->mapEntityList($propValue, $tag);
                }
                // It's an entity
                elseif (is_object($propValue) && (!$propValue instanceof \DateTime)) {
                    $xml .= $this->mapSingleEntity($propValue);
                }
                else {
                    $propValue = (string) $propValue;
                    // Use Character Data for non integers
                    if (!ctype_digit($propValue)) {
                       $propValue = "<![CDATA[$propValue]]>";
                    }
                    $xml .= $propValue;
                }
                $xml .= '</FL>';
            }
        }
        return $xml;
    }
protected function mapSingleEntity ( Element $ entity ) { $ element = new \ ReflectionObject ( $ entity ) ; $ properties = $ element -> getProperties ( ) ; $ xml = '' ; foreach ( $ properties as $ property ) { $ propName = $ property -> getName ( ) ; $ propValue = $ entity -> $ propName ; if ( $ propValue !== null ) { $ xml .= '<FL val="' . str_replace ( [ '_' , 'N36' , 'E5F' , '&' , '98T' ] , [ ' ' , '$' , '_' , 'and' , '?' ] , $ propName ) . '">' ; // It's a list of entities if ( is_array ( $ propValue ) ) { $ tag = null ; list ( $ key , $ list ) = each ( $ propValue ) ; if ( ! is_numeric ( $ key ) ) { $ tag = $ key ; $ propValue = $ list ; } $ xml .= $ this -> mapEntityList ( $ propValue , $ tag ) ; } // It's an entity elseif ( is_object ( $ propValue ) && ( ! $ propValue instanceof \ DateTime ) ) { $ xml .= $ this -> mapSingleEntity ( $ propValue ) ; } else { $ propValue = ( string ) $ propValue ; // Use Character Data for non integers if ( ! ctype_digit ( $ propValue ) ) { $ propValue = "<![CDATA[$propValue]]>" ; } $ xml .= $ propValue ; } $ xml .= '</FL>' ; } } return $ xml ; }
Convert single entity into XML

@param Element $entity Element
@return string XML created
Convert single entity into XML