src/sb/RSS/Feed.php
private function appendItem(\sb\RSS\Item $item)
    {

        $new_item = $this->createElement("item");

        foreach(get_object_vars($item) as $key=>$val){
            if($item->{$key} instanceof \sb\RSS\ItemEnclosure){
                $enclosure = $this->createElement('enclosure');
                foreach($item->{$key} as $n=>$v){
                    $enclosure->setAttribute($n, $v);
                }

                $new_item->appendChild($enclosure);
            }

            if($key == 'categories'){
                foreach($item->{$key} as $category){
                    $new_item->appendChild($this->createNode('category', $category));
                }
            }

            if(is_string($val) && !empty($val)){

                $new_item->appendChild($this->createNode($key, $val, $key == 'description'));
            }
        }

        if(empty($item->guid)){
            $new_item->appendChild($this->createNode('guid', $item->link));
        }

        $this->channel->appendChild($new_item);

    }
private function appendItem(\sb\RSS\Item $item)
    {

        $new_item = $this->createElement("item");

        foreach(get_object_vars($item) as $key=>$val){
            if($item->{$key} instanceof \sb\RSS\ItemEnclosure){
                $enclosure = $this->createElement('enclosure');
                foreach($item->{$key} as $n=>$v){
                    $enclosure->setAttribute($n, $v);
                }

                $new_item->appendChild($enclosure);
            }

            if($key == 'categories'){
                foreach($item->{$key} as $category){
                    $new_item->appendChild($this->createNode('category', $category));
                }
            }

            if(is_string($val) && !empty($val)){

                $new_item->appendChild($this->createNode($key, $val, $key == 'description'));
            }
        }

        if(empty($item->guid)){
            $new_item->appendChild($this->createNode('guid', $item->link));
        }

        $this->channel->appendChild($new_item);

    }
private function appendItem ( \ sb \ RSS \ Item $ item ) { $ new_item = $ this -> createElement ( "item" ) ; foreach ( get_object_vars ( $ item ) as $ key => $ val ) { if ( $ item -> { $ key } instanceof \ sb \ RSS \ ItemEnclosure ) { $ enclosure = $ this -> createElement ( 'enclosure' ) ; foreach ( $ item -> { $ key } as $ n => $ v ) { $ enclosure -> setAttribute ( $ n , $ v ) ; } $ new_item -> appendChild ( $ enclosure ) ; } if ( $ key == 'categories' ) { foreach ( $ item -> { $ key } as $ category ) { $ new_item -> appendChild ( $ this -> createNode ( 'category' , $ category ) ) ; } } if ( is_string ( $ val ) && ! empty ( $ val ) ) { $ new_item -> appendChild ( $ this -> createNode ( $ key , $ val , $ key == 'description' ) ) ; } } if ( empty ( $ item -> guid ) ) { $ new_item -> appendChild ( $ this -> createNode ( 'guid' , $ item -> link ) ) ; } $ this -> channel -> appendChild ( $ new_item ) ; }
Takes an \sb\RSS\Item and converts it into a DOMM node followed by inserting it into the feed DOM

@param \sb\RSS\Item $item
Takes an \ sb \ RSS \ Item and converts it into a DOMM node followed by inserting it into the feed DOM