From 04f28335808d671224cb2110b35cbc1105aefccc Mon Sep 17 00:00:00 2001 From: Hannes Magnusson Date: Wed, 2 Feb 2011 14:11:16 +0000 Subject: [PATCH] - Replace "void" with &no.function.params; - Replace some "returns true if all was good" with &return.success; - Document exceptions thrown - Document the ctor array keys properly - Minor update to some examples git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@307957 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/amqp/amqpconnection/connect.xml | 13 ++-- reference/amqp/amqpconnection/construct.xml | 68 +++++++++++++++++-- reference/amqp/amqpconnection/isconnected.xml | 11 ++- reference/amqp/amqpconnection/reconnect.xml | 13 ++-- reference/amqp/amqpconnection/sethost.xml | 10 ++- reference/amqp/amqpconnection/setlogin.xml | 10 ++- reference/amqp/amqpconnection/setpassword.xml | 10 ++- reference/amqp/amqpconnection/setport.xml | 10 ++- 8 files changed, 117 insertions(+), 28 deletions(-) diff --git a/reference/amqp/amqpconnection/connect.xml b/reference/amqp/amqpconnection/connect.xml index f8006118f0..9c70458a30 100644 --- a/reference/amqp/amqpconnection/connect.xml +++ b/reference/amqp/amqpconnection/connect.xml @@ -20,15 +20,13 @@ &reftitle.parameters; - - void - + &no.function.parameters; &reftitle.returnvalues; - Returns true if connection was successful, false otherwise. + &return.success; @@ -48,8 +46,11 @@ $cnn = new AMQPConnection(); $cnn->setLogin('mylogin'); $cnn->setPassword('mypass'); -if (!$cnn->connect()) { - throw new Exception('Could not connect'); +if ($cnn->connect()) { + echo "Established a connection to the broker"; +} +else { + echo "Cannot connect to the broker"; } diff --git a/reference/amqp/amqpconnection/construct.xml b/reference/amqp/amqpconnection/construct.xml index e8ea7a5aa2..ebc9eb40c4 100644 --- a/reference/amqp/amqpconnection/construct.xml +++ b/reference/amqp/amqpconnection/construct.xml @@ -27,12 +27,49 @@ The credentials is an optional array of credential information for connecting to the AMQP - broker. The keys used in the credentials array are: host, port, vhost, login and password. - All other keys will be ignored. + broker. - - For each missing credential, the extension will check the ini settings or use the default value. - + + Supported indexes + + + + key + Description + Default value + + + + + + host + The host to connect too Max 32 characters + amqp.host + + + port + Port on the host + amqp.port + + + vhost + The virtual host on the host Max 32 characters + amqp.vhost + + + login + The login name to use. Max 32 characters + amqp.login + + + password + Password Max 32 characters + amqp.password + + + +
+ All other keys will be ignored.
@@ -46,6 +83,14 @@ + + &reftitle.errors; + + Throws AMQPException exception on parameter parsing + failures, and option errors. + + + &reftitle.examples; @@ -55,9 +100,10 @@ 'example.host', 'vhost' => '/', @@ -73,7 +119,15 @@ $connection2 = new AMQPConnection(array( - + + &reftitle.notes; + + + A connection will not be established untill + AMQPConnection::connect is called. + + + + diff --git a/reference/amqp/amqpconnection/reconnect.xml b/reference/amqp/amqpconnection/reconnect.xml index 2759d3eac7..8a88d4f6b0 100644 --- a/reference/amqp/amqpconnection/reconnect.xml +++ b/reference/amqp/amqpconnection/reconnect.xml @@ -20,15 +20,13 @@ &reftitle.parameters; - - void - + &no.function.parameters; &reftitle.returnvalues; - Returns true if reconnect was successful, false otherwise. + &return.success; @@ -48,15 +46,14 @@ $cnn = new AMQPConnection(); $cnn->setLogin('mylogin'); $cnn->setPassword('mypass'); -if (!$cnn->connect()) { - throw new Exception('Could not connect'); -} +$cnn->connect(); // do something interesting + // ensure we have a valid connection if (!$cnn->reconnect()) { - throw new Exception('Could not reconnect'); + echo "Could not reconnect to server"; } ?> diff --git a/reference/amqp/amqpconnection/sethost.xml b/reference/amqp/amqpconnection/sethost.xml index 13f342b59e..3d7fbccec7 100644 --- a/reference/amqp/amqpconnection/sethost.xml +++ b/reference/amqp/amqpconnection/sethost.xml @@ -37,7 +37,15 @@ &reftitle.returnvalues; - void + &return.success; + + + + + &reftitle.errors; + + Throws an AMQPConnectionException if + host is longer then 1024characters. diff --git a/reference/amqp/amqpconnection/setlogin.xml b/reference/amqp/amqpconnection/setlogin.xml index 11aabb83d3..44aca75af4 100644 --- a/reference/amqp/amqpconnection/setlogin.xml +++ b/reference/amqp/amqpconnection/setlogin.xml @@ -37,7 +37,15 @@ &reftitle.returnvalues; - void + &return.success; + + + + + &reftitle.errors; + + Throws an AMQPConnectionException if + login is longer then 32characters. diff --git a/reference/amqp/amqpconnection/setpassword.xml b/reference/amqp/amqpconnection/setpassword.xml index 3c71eddda2..9fa1dd72f6 100644 --- a/reference/amqp/amqpconnection/setpassword.xml +++ b/reference/amqp/amqpconnection/setpassword.xml @@ -37,7 +37,15 @@ &reftitle.returnvalues; - void + &return.success; + + + + + &reftitle.errors; + + Throws an AMQPConnectionException if + password is longer then 32characters. diff --git a/reference/amqp/amqpconnection/setport.xml b/reference/amqp/amqpconnection/setport.xml index 94b2a08ded..afe3348266 100644 --- a/reference/amqp/amqpconnection/setport.xml +++ b/reference/amqp/amqpconnection/setport.xml @@ -37,7 +37,15 @@ &reftitle.returnvalues; - void + &return.success; + + + + + &reftitle.errors; + + Throws an AMQPConnectionException if + port is longer not between 1 and 65535.