Skip to content

Commit

Permalink
Simplified the CakeSocket and fixed some phpdocs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Nov 9, 2010
1 parent fb5495f commit 8c29847
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions cake/libs/cake_socket.php
Expand Up @@ -138,9 +138,8 @@ public function connect() {
public function host() {
if (Validation::ip($this->config['host'])) {
return gethostbyaddr($this->config['host']);
} else {
return gethostbyaddr($this->address());
}
return gethostbyaddr($this->address());
}

/**
Expand All @@ -151,9 +150,8 @@ public function host() {
public function address() {
if (Validation::ip($this->config['host'])) {
return $this->config['host'];
} else {
return gethostbyname($this->config['host']);
}
return gethostbyname($this->config['host']);
}

/**
Expand All @@ -164,9 +162,8 @@ public function address() {
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']);
}

/**
Expand All @@ -177,16 +174,16 @@ public function addresses() {
public function lastError() {
if (!empty($this->lastError)) {
return $this->lastError['num'] . ': ' . $this->lastError['str'];
} else {
return null;
}
return null;
}

/**
* Set the last error.
*
* @param integer $errNum Error code
* @param string $errStr Error string
* @return void
*/
public function setLastError($errNum, $errStr) {
$this->lastError = array('num' => $errNum, 'str' => $errStr);
Expand Down Expand Up @@ -230,17 +227,8 @@ public function read($length = 1024) {
return false;
}
return $buffer;
} else {
return false;
}
}

/**
* Abort socket operation.
*
* @return boolean Success
*/
public function abort() {
return false;
}

/**
Expand Down Expand Up @@ -273,6 +261,7 @@ function __destruct() {
/**
* 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) {
Expand Down

0 comments on commit 8c29847

Please sign in to comment.