Skip to content

Commit

Permalink
Allow for use of a default server in the worker the same way as the c…
Browse files Browse the repository at this point in the history
…lient
  • Loading branch information
brianlmoon authored and lenn0x committed Jun 6, 2011
1 parent 2391d67 commit 77cbbb1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Net/Gearman/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,11 @@ class Net_Gearman_Worker
* @throws Net_Gearman_Exception
* @see Net_Gearman_Connection
*/
public function __construct($servers, $id = "")
public function __construct($servers = null, $id = "")
{
if (!is_array($servers) && strlen($servers)) {
if (is_null($servers)){
$servers = array("localhost");
} elseif (!is_array($servers) && strlen($servers)) {
$servers = array($servers);
} elseif (is_array($servers) && !count($servers)) {
throw new Net_Gearman_Exception('Invalid servers specified');
Expand Down

0 comments on commit 77cbbb1

Please sign in to comment.