PEAR_ChannelFile::addFunction()
PEAR_ChannelFile::addFunction()
-- provides セクションにプロトコルを追加する
概要
require_once '/ChannelFile.php'; |
bool
PEAR_ChannelFile::addFunction
(string
$type, string
$version, string
[$name = ''], string
[$mirror = false])
説明
チャネル定義ファイルに、サポートされる xml-rpc 関数あるいは
SOAP 関数を追加します。型は xmlrpc あるいは
soap で、小文字で指定しなければなりません。
追加時に型の検証は行われません。例えば
<?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');
?>
|
oops プロトコルの作成には成功しますが、
検証時には失敗します。
関数をミラーに追加する際には、ミラーが存在するかどうかがチェックされます。
<?php
require_once 'PEAR/ChannelFile.php';
$chan = new PEAR_ChannelFile;
$chan->setName('foo.example.com');
$chan->setSummary('demonstrate addFunction');
// 失敗します: ミラーが見つかりません
$chan->addFunction('soap', '1.0', 'people.list', 'mirror.example.com');
$chan->addMirror('mirror.example.com');
// 成功します
$chan->addFunction('soap', '1.0', 'people.list', 'mirror.example.com');
?>
|
パラメータ
- string
$version
プロトコルのバージョン。
- string
$name
存在する場合は、プロトコルの名前。
- string
$mirror
ミラーのプロトコルである場合に、ミラーの名前。
注意
この関数は、スタティックにコールする
ことはできません。