protected function pluralize(array $xml, array $rules)
    {
        foreach ($xml as $attribute => $value) {
            if (isset($rules[$attribute])) {
                $xml[$rules[$attribute]] = $value;
                unset($xml[$attribute]);

                $attribute = $rules[$attribute];

                if (!is_array($value) || is_string(key($value))) {
                    $xml[$attribute] = array($value);
                }
            }

            if (is_array($xml[$attribute])) {
                $xml[$attribute] = $this->pluralize($xml[$attribute], $rules);
            }
        }

        return $this->normalize($xml);
    }
protected function pluralize(array $xml, array $rules)
    {
        foreach ($xml as $attribute => $value) {
            if (isset($rules[$attribute])) {
                $xml[$rules[$attribute]] = $value;
                unset($xml[$attribute]);

                $attribute = $rules[$attribute];

                if (!is_array($value) || is_string(key($value))) {
                    $xml[$attribute] = array($value);
                }
            }

            if (is_array($xml[$attribute])) {
                $xml[$attribute] = $this->pluralize($xml[$attribute], $rules);
            }
        }

        return $this->normalize($xml);
    }
protected function pluralize ( array $ xml , array $ rules ) { foreach ( $ xml as $ attribute => $ value ) { if ( isset ( $ rules [ $ attribute ] ) ) { $ xml [ $ rules [ $ attribute ] ] = $ value ; unset ( $ xml [ $ attribute ] ) ; $ attribute = $ rules [ $ attribute ] ; if ( ! is_array ( $ value ) || is_string ( key ( $ value ) ) ) { $ xml [ $ attribute ] = array ( $ value ) ; } } if ( is_array ( $ xml [ $ attribute ] ) ) { $ xml [ $ attribute ] = $ this -> pluralize ( $ xml [ $ attribute ] , $ rules ) ; } } return $ this -> normalize ( $ xml ) ; }
Pluralizes xml.

@param array $xml   The xml.
@param array $rules The pluralization rules.

@return \stdClass The pluralized xml.
Pluralizes xml .