mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-04-25 01:28:02 +02:00
233 lines
5.7 KiB
XML
233 lines
5.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: af5f2f87b3b0bb9ee0f83ccb787a4e7db1eb6bd4 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: yes Maintainer: yannick -->
|
|
|
|
<refentry xml:id="function.yaml-emit" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>yaml_emit</refname>
|
|
<refpurpose>Retourne une chaîne représentant une valeur YAML</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>yaml_emit</methodname>
|
|
<methodparam><type>mixed</type><parameter>data</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>encoding</parameter><initializer>YAML_ANY_ENCODING</initializer></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>linebreak</parameter><initializer>YAML_ANY_BREAK</initializer></methodparam>
|
|
<methodparam choice="opt"><type>array</type><parameter>callbacks</parameter><initializer>&null;</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Génère une représentation YAML de la donnée <parameter>data</parameter>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>data</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Les données à encoder. Peut être de tout type sauf <type>resource</type>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>encoding</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Encodage des caractères en sortie choisi parmi
|
|
<constant>YAML_ANY_ENCODING</constant>,
|
|
<constant>YAML_UTF8_ENCODING</constant>,
|
|
<constant>YAML_UTF16LE_ENCODING</constant>,
|
|
<constant>YAML_UTF16BE_ENCODING</constant>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>linebreak</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Caractère de fin de ligne choisi parmi
|
|
<constant>YAML_ANY_BREAK</constant>,
|
|
<constant>YAML_CR_BREAK</constant>,
|
|
<constant>YAML_LN_BREAK</constant>,
|
|
<constant>YAML_CRLN_BREAK</constant>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>callbacks</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Gestionnaires de contenu pour l'émission de nœud YAML.
|
|
Doit être un tableau associatif de paires "nom de classe" =>
|
|
<type>callable</type>. Voir
|
|
<link linkend="yaml.callbacks.emit">l'émission de fonctions de rappel</link>
|
|
pour plus de détails.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Retourne une chaîne YAML en cas de succès.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>PECL yaml 1.1.0</entry>
|
|
<entry>
|
|
Le paramètre <parameter>callbacks</parameter> a été ajouté.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemple <function>yaml_emit</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$addr = array(
|
|
"given" => "Chris",
|
|
"family"=> "Dumars",
|
|
"address"=> array(
|
|
"lines"=> "458 Walkman Dr.
|
|
Suite #292",
|
|
"city"=> "Royal Oak",
|
|
"state"=> "MI",
|
|
"postal"=> 48046,
|
|
),
|
|
);
|
|
$invoice = array (
|
|
"invoice"=> 34843,
|
|
"date"=> 980208000,
|
|
"bill-to"=> $addr,
|
|
"ship-to"=> $addr,
|
|
"product"=> array(
|
|
array(
|
|
"sku"=> "BL394D",
|
|
"quantity"=> 4,
|
|
"description"=> "Basketball",
|
|
"price"=> 450,
|
|
),
|
|
array(
|
|
"sku"=> "BL4438H",
|
|
"quantity"=> 1,
|
|
"description"=> "Super Hoop",
|
|
"price"=> 2392,
|
|
),
|
|
),
|
|
"tax"=> 251.42,
|
|
"total"=> 4443.52,
|
|
"comments"=> "Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.",
|
|
);
|
|
var_dump(yaml_emit($invoice));
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
string(628) "---
|
|
invoice: 34843
|
|
date: 980208000
|
|
bill-to:
|
|
given: Chris
|
|
family: Dumars
|
|
address:
|
|
lines: |-
|
|
458 Walkman Dr.
|
|
Suite #292
|
|
city: Royal Oak
|
|
state: MI
|
|
postal: 48046
|
|
ship-to:
|
|
given: Chris
|
|
family: Dumars
|
|
address:
|
|
lines: |-
|
|
458 Walkman Dr.
|
|
Suite #292
|
|
city: Royal Oak
|
|
state: MI
|
|
postal: 48046
|
|
product:
|
|
- sku: BL394D
|
|
quantity: 4
|
|
description: Basketball
|
|
price: 450
|
|
- sku: BL4438H
|
|
quantity: 1
|
|
description: Super Hoop
|
|
price: 2392
|
|
tax: 251.420000
|
|
total: 4443.520000
|
|
comments: Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.
|
|
...
|
|
"
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>yaml_emit_file</function></member>
|
|
<member><function>yaml_parse</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|