X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FZhClient.php;h=d3d79165397bfe56afe8a9a50c94ed095a6ce4b1;hb=fd03a2922af901d5c12e1039aed84647efd757f6;hp=5404b696fb4a540e7f6f627d13dbd1fd22eba348;hpb=3b5750adb4c8bb376a7db5c471890b991060d03f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ZhClient.php b/includes/ZhClient.php index 5404b696fb..d3d7916539 100644 --- a/includes/ZhClient.php +++ b/includes/ZhClient.php @@ -9,7 +9,10 @@ class ZhClient { /** * Constructor * - * @access private + * @param $host + * @param $port + * + * @return ZhClient */ function __construct( $host, $port ) { $this->mHost = $host; @@ -19,6 +22,8 @@ class ZhClient { /** * Check if connection to zhdaemon is successful + * + * @return bool */ function isconnected() { return $this->mConnected; @@ -28,22 +33,23 @@ class ZhClient { * Establish conncetion * * @access private + * + * @return bool */ function connect() { wfSuppressWarnings(); $errno = $errstr = ''; $this->mFP = fsockopen( $this->mHost, $this->mPort, $errno, $errstr, 30 ); wfRestoreWarnings(); - if ( !$this->mFP ) { - return false; - } - return true; + return !$this->mFP; } /** * Query the daemon and return the result * * @access private + * + * @return string */ function query( $request ) { if ( !$this->mConnected ) { @@ -68,10 +74,7 @@ class ZhClient { $data .= $str; } // data should be of length $len. otherwise something is wrong - if ( strlen( $data ) != $len ) { - return false; - } - return $data; + return strlen( $data ) == $len; } /** @@ -115,6 +118,7 @@ class ZhClient { } return $ret; } + /** * Perform word segmentation *