src/sb/RSS/Feed.php
private function channelPropertiesToDOM()
    {

        foreach(get_object_vars($this) as $key=>$val){

            //parse string based key value pairs
            if (is_string($val) && !empty($val)){
                $this->channel->appendChild($this->createNode($key, $val, $key == 'description'));

            //parse image
            } elseif ($this->{$key} instanceof \sb\RSS\Image){


                $image = $this->createElement('image');
                foreach($this->{$key} as $n=>$v){

                    $image->appendChild($this->createNode($n, $v));
                }

                $image->appendChild($this->createNode('link', $this->link));

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

            //parse cloud
            } elseif ($this->{$key} instanceof \sb\RSS_Cloud){

                $cloud = $this->createElement('cloud');
                foreach($this->{$key} as $n=>$v){
                    $cloud->setAttribute($n, $v);
                }

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

            } elseif($key == 'categories'){
                foreach($this->{$key} as $category){
                    $this->channel->appendChild($this->createNode('category', $category));
                }

            //parse skipHours and skipDays
            } elseif($key == 'skipHours' || $key == 'skipDays'){

                $node = $this->createElement($key);
                $nodeName = ($key =='skipHours') ? 'hour' : 'day';
                foreach($this->{$key} as $value){
                    //force caps on day name as it is required to validate
                    $node->appendChild($this->createNode($nodeName, ucwords($value)));
                }

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

            }

        }
    }
private function channelPropertiesToDOM()
    {

        foreach(get_object_vars($this) as $key=>$val){

            //parse string based key value pairs
            if (is_string($val) && !empty($val)){
                $this->channel->appendChild($this->createNode($key, $val, $key == 'description'));

            //parse image
            } elseif ($this->{$key} instanceof \sb\RSS\Image){


                $image = $this->createElement('image');
                foreach($this->{$key} as $n=>$v){

                    $image->appendChild($this->createNode($n, $v));
                }

                $image->appendChild($this->createNode('link', $this->link));

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

            //parse cloud
            } elseif ($this->{$key} instanceof \sb\RSS_Cloud){

                $cloud = $this->createElement('cloud');
                foreach($this->{$key} as $n=>$v){
                    $cloud->setAttribute($n, $v);
                }

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

            } elseif($key == 'categories'){
                foreach($this->{$key} as $category){
                    $this->channel->appendChild($this->createNode('category', $category));
                }

            //parse skipHours and skipDays
            } elseif($key == 'skipHours' || $key == 'skipDays'){

                $node = $this->createElement($key);
                $nodeName = ($key =='skipHours') ? 'hour' : 'day';
                foreach($this->{$key} as $value){
                    //force caps on day name as it is required to validate
                    $node->appendChild($this->createNode($nodeName, ucwords($value)));
                }

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

            }

        }
    }
private function channelPropertiesToDOM ( ) { foreach ( get_object_vars ( $ this ) as $ key => $ val ) { //parse string based key value pairs if ( is_string ( $ val ) && ! empty ( $ val ) ) { $ this -> channel -> appendChild ( $ this -> createNode ( $ key , $ val , $ key == 'description' ) ) ; //parse image } elseif ( $ this -> { $ key } instanceof \ sb \ RSS \ Image ) { $ image = $ this -> createElement ( 'image' ) ; foreach ( $ this -> { $ key } as $ n => $ v ) { $ image -> appendChild ( $ this -> createNode ( $ n , $ v ) ) ; } $ image -> appendChild ( $ this -> createNode ( 'link' , $ this -> link ) ) ; $ this -> channel -> appendChild ( $ image ) ; //parse cloud } elseif ( $ this -> { $ key } instanceof \ sb \ RSS_Cloud ) { $ cloud = $ this -> createElement ( 'cloud' ) ; foreach ( $ this -> { $ key } as $ n => $ v ) { $ cloud -> setAttribute ( $ n , $ v ) ; } $ this -> channel -> appendChild ( $ cloud ) ; } elseif ( $ key == 'categories' ) { foreach ( $ this -> { $ key } as $ category ) { $ this -> channel -> appendChild ( $ this -> createNode ( 'category' , $ category ) ) ; } //parse skipHours and skipDays } elseif ( $ key == 'skipHours' || $ key == 'skipDays' ) { $ node = $ this -> createElement ( $ key ) ; $ nodeName = ( $ key == 'skipHours' ) ? 'hour' : 'day' ; foreach ( $ this -> { $ key } as $ value ) { //force caps on day name as it is required to validate $ node -> appendChild ( $ this -> createNode ( $ nodeName , ucwords ( $ value ) ) ) ; } $ this -> channel -> appendChild ( $ node ) ; } } }
Converts all the feed object properties into RSS DOM nodes and adds them to the channel node
Converts all the feed object properties into RSS DOM nodes and adds them to the channel node