PEAR_ChannelFile::addFunction

PEAR_ChannelFile::addFunction() – Ajoute un protocole à la section fournie

Synopsis

require_once '/ChannelFile.php';

bool PEAR_ChannelFile::addFunction ( string $type , string $version , string $name = '' , string $mirror = false )

Description

Ajoute un support pour les fonctions xml-rpc or SOAP à un fichier de définition de canal. Le type doit être xmlrpc ou soap en minuscule. Aucune validation n'est effectué à l'insertion. Par exemple :

<?php
require_once 'PEAR/ChannelFile.php';
$chan = new PEAR_ChannelFile;
$chan->setName('foo.example.com');
$chan->setSummary('demonstrate addFunction');
$chan->addFunction('xmlrpc''1.0''people.list');
$chan->addFunction('oops''1.0''bad.type');
?>

Le protocole oops sera créé avec succès mais échouera à la validation.

Ajout d'une fonction à un miroir en effectuant une validation simple afin de s'assurer que le miroir existe déjà.

<?php
require_once 'PEAR/ChannelFile.php';
$chan = new PEAR_ChannelFile;
$chan->setName('foo.example.com');
$chan->setSummary('demonstrate addFunction');
// fails: mirror not found
$chan->addFunction('soap''1.0''people.list''mirror.example.com');
$chan->addMirror('mirror.example.com');
// succeeds
$chan->addFunction('soap''1.0''people.list''mirror.example.com');
?>

Parameter

string $type

Type du protocole

string $version

Version du protocole

string $name

Nom du protocole, s'il en a un

string $mirror

Nom du miroir, si c'est un protocole de miroir

Throws

No exceptions thrown.

Note

This function can not be called statically.