protected static function _encodeYaml($indent, $data)
    {
        reset($data);
        $result = "";
        $numeric = is_numeric(key($data));

        foreach($data as $key => $value) {
            if(is_array($value)) {
                $encoded = "\n".self::_encodeYaml($indent+1, $value);
            } else {
                $encoded = (string)$value."\n";
            }
            $result .= str_repeat("  ", $indent).($numeric?"- ":"$key: ").$encoded;
        }
        return $result;
    }
protected static function _encodeYaml($indent, $data)
    {
        reset($data);
        $result = "";
        $numeric = is_numeric(key($data));

        foreach($data as $key => $value) {
            if(is_array($value)) {
                $encoded = "\n".self::_encodeYaml($indent+1, $value);
            } else {
                $encoded = (string)$value."\n";
            }
            $result .= str_repeat("  ", $indent).($numeric?"- ":"$key: ").$encoded;
        }
        return $result;
    }
protected static function _encodeYaml ( $ indent , $ data ) { reset ( $ data ) ; $ result = "" ; $ numeric = is_numeric ( key ( $ data ) ) ; foreach ( $ data as $ key => $ value ) { if ( is_array ( $ value ) ) { $ encoded = "\n" . self :: _encodeYaml ( $ indent + 1 , $ value ) ; } else { $ encoded = ( string ) $ value . "\n" ; } $ result .= str_repeat ( "  " , $ indent ) . ( $ numeric ? "- " : "$key: " ) . $ encoded ; } return $ result ; }
Service function for encoding YAML

@param int $indent Current indent level
@param array $data Data to encode
@return string
Service function for encoding YAML