Simplified the CakeSocket and fixed some phpdocs.

This commit is contained in:
Juan Basso 2010-11-09 19:07:29 -02:00
parent fb5495fad5
commit 8c29847c8f

View file

@ -138,9 +138,8 @@ class CakeSocket {
public function host() {
if (Validation::ip($this->config['host'])) {
return gethostbyaddr($this->config['host']);
} else {
return gethostbyaddr($this->address());
}
return gethostbyaddr($this->address());
}
/**
@ -151,9 +150,8 @@ class CakeSocket {
public function address() {
if (Validation::ip($this->config['host'])) {
return $this->config['host'];
} else {
return gethostbyname($this->config['host']);
}
return gethostbyname($this->config['host']);
}
/**
@ -164,9 +162,8 @@ class CakeSocket {
public function addresses() {
if (Validation::ip($this->config['host'])) {
return array($this->config['host']);
} else {
return gethostbynamel($this->config['host']);
}
return gethostbynamel($this->config['host']);
}
/**
@ -177,9 +174,8 @@ class CakeSocket {
public function lastError() {
if (!empty($this->lastError)) {
return $this->lastError['num'] . ': ' . $this->lastError['str'];
} else {
return null;
}
return null;
}
/**
@ -187,6 +183,7 @@ class CakeSocket {
*
* @param integer $errNum Error code
* @param string $errStr Error string
* @return void
*/
public function setLastError($errNum, $errStr) {
$this->lastError = array('num' => $errNum, 'str' => $errStr);
@ -230,17 +227,8 @@ class CakeSocket {
return false;
}
return $buffer;
} else {
return false;
}
}
/**
* Abort socket operation.
*
* @return boolean Success
*/
public function abort() {
return false;
}
/**
@ -273,6 +261,7 @@ class CakeSocket {
/**
* Resets the state of this Socket instance to it's initial state (before Object::__construct got executed)
*
* @param array $state Array with key and values to reset
* @return boolean True on success
*/
public function reset($state = null) {