Index: Dict.php =================================================================== --- Dict.php (revision 292109) +++ Dict.php (working copy) @@ -13,15 +13,15 @@ * the PHP License and are unable to obtain it through the web, please * send a note to license@php.net so we can mail you a copy immediately. * - * @category Networking - * @package Net_Dict - * @author Chandrashekhar Bhosle - * @author Ian Eure - * @copyright (c) 2002 Chandrashekhar Bhosle - * @copyright (c) 2005, 2006 Ian Eure - * @license http://www.php.net/license/2_02.txt PHP License 2.02 - * @version CVS: $Revision$ - * @link http://pear.php.net/package/Net_Dict + * @category Networking + * @package Net_Dict + * @author Chandrashekhar Bhosle + * @author Ian Eure + * @copyright 2002 Chandrashekhar Bhosle + * @copyright 2005-2006 Ian Eure + * @license http://www.php.net/license/2_02.txt PHP License 2.02 + * @version CVS: $Revision$ + * @link http://pear.php.net/package/Net_Dict */ require_once 'PEAR.php'; @@ -29,22 +29,22 @@ define('NET_DICT_SERVER', 'dict.org'); -define('NET_DICT_PORT', '2628'); +define('NET_DICT_PORT', '2628'); /** * The main Net_Dict class * * Net_Dict is a PHP interface for talking to dictd servers. * - * @package Net_Dict - * @category Networking - * @link http://pear.php.net/package/Net_Dict - * @version Release: @package_version@ - * @version CVS: $Revision$ - * @author Chandrashekhar Bhosle - * @license http://www.php.net/license/2_02.txt PHP License v2.02 + * @category Networking + * @package Net_Dict + * @author Chandrashekhar Bhosle + * @license http://www.php.net/license/2_02.txt PHP License v2.02 + * @version Release: @package_version@ + * @link http://pear.php.net/package/Net_Dict */ -class Net_Dict { +class Net_Dict +{ /** * Default DICT server name * @@ -91,8 +91,8 @@ /** * Gets definitions for the specified word in the specified database. * - * @param string $word - * @param string $database + * @param string $word Word to lookup + * @param string $database Database spec, defaults to all * * @return mixed Array of definitions if sucessful, else PEAR_Error */ @@ -148,9 +148,9 @@ * Searches an index for the dictionary, and reports words * which were found using a particular strategy. * - * @param string $word - * @param string $strategy - * @param string $database + * @param string $word Word too look for in the index + * @param string $strategy Strategy to use, defaults to 'substring' + * @param string $database Database(s) to search, defaults to all * * @return mixed Array of matches if successful, else PEAR_Error */ @@ -234,7 +234,7 @@ * Gets source, copyright, and licensing information about the * specified database. * - * @param string $database + * @param string $database Database to get info from * * @return mixed string if successful, else PEAR_Error */ @@ -263,7 +263,7 @@ * MUST implement this command (note, though, that the server doesn't * have to do anything with the information provided by the client). * - * @param string $text + * @param string $text Client-info * * @return mixed string if successful, else PEAR_Error */ @@ -326,8 +326,8 @@ * password. The authentication-string will be computed as in the APOP * protocol discussed in [RFC1939]. * - * @param string $user - * @param string $auth + * @param string $user Username + * @param string $auth APOP authentication-string * * @return mixed * @todo Implement this method. @@ -341,8 +341,9 @@ * being developed [RFC2222]. The DICT protocol reserves the SASLAUTH * and SASLRESP commands for this method of authentication. * - * @param string $mechanism - * @param string $initial_response + * @param string $mechanism SASL mechanism to use + * @param string $initial_response SASL Response + * * @return mixed * @todo Implement this method. */ @@ -354,7 +355,8 @@ * The client will send all responses using the SASLRESP command and a * BASE64-encoded parameter. * - * @param string $response + * @param string $response Response to send + * * @return mixed * @todo Implement this method. */ @@ -365,8 +367,9 @@ /** * Connects to a dict server and sets up a socket * - * @param string $server - * @param integer $port + * @param string $server Server name to connect to + * @param integer $port Port number + * * @return mixed true on success, else PEAR_Error */ function connect($server = '', $port = 0) @@ -388,7 +391,7 @@ return $err; } - $banner = $s->readLine(); + $banner = $s->readLine(); $resp['code'] = substr($banner, 0, 3); $resp['text'] = ltrim(substr($banner, 3)); @@ -426,9 +429,10 @@ /** * Sets the server and port of dict server * - * @param string $server - * @param int $port - * @return void + * @param string $server Server name / address + * @param integer $port Port number + * + * @return void */ function setServer($server, $port = 0) { @@ -442,9 +446,10 @@ /** * Sets caching on or off and provides the cache type and parameters * - * @param boolean $cache - * @param string $container - * @param array $container_options + * @param boolean $flag Whether the results should be cached + * @param string $container Container name for Cache + * @param array $container_options Container options for Cache + * * @return void */ function setCache($flag = false, $container = '', $container_options = '') @@ -452,7 +457,7 @@ $this->caching = $flag; if ($this->caching) { - require_once 'Cache.php'; + include_once 'Cache.php'; if (is_object($this->cache)) { unset($this->cache); @@ -467,7 +472,8 @@ * if good returns the reponse, other wise * returns false. * - * @param $cmd Command to send (\r\n will be appended) + * @param string $cmd Command to send (\r\n will be appended) + * * @return mixed First line of response if successful, otherwise false */ function _sendCmd($cmd) @@ -519,6 +525,10 @@ * Alias to Net_Socket::readLine(); * * @see Net_Socket::readLine(); + * + * @return All available data up to a newline, without that + * newline, or until the end of the socket, or a PEAR_Error if + * not connected. */ function readLine() { @@ -528,7 +538,8 @@ /** * Runs a generic dict query * - * @param string $query + * @param string $query The query to pass to the dict server + * * @return mixed string on success, else PEAR_Error */ function simpleQuery($query) @@ -549,7 +560,8 @@ /** * Checks if a response code is positive * - * @param array $resp + * @param array $resp Response to check + * * @return boolean */ function isOK($resp) @@ -560,4 +572,4 @@ } } -?> \ No newline at end of file +?>