PEAR_ChannelFile::addFunction

PEAR_ChannelFile::addFunction()

PEAR_ChannelFile::addFunction()  -- Add a protocol to the provides section

Description

Adds a supported xml-rpc or SOAP function to a channel definition file. The type should be xmlrpc or soap in lower-cased letters. No validation is performed on insert. For example:

<?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');
?>

The oops protocol will be successfully created, but will fail upon validation.

Adding a function to a mirror simply validated to ensure that the mirror already exists.

<?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

protocol type

string $version

protocol version

string $name

protocol name, if any

string $mirror

mirror name, if this is a mirror's protocol

Throws

throws no exceptions thrown

Note

This function can not be called statically.

© Copyright 2003-2023 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.