Skip to content

Commit

Permalink
doc fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomáš Pecsérke committed Feb 18, 2014
1 parent fa18996 commit 29d21af
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 41 deletions.
19 changes: 10 additions & 9 deletions lib/Net/Gearman/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Client implements ServerSetting
/**
* Our randomly selected connection
*
* @var resource $conn An open socket to Gearman
* @var resource[] $conn An array of open socket to Gearman
*/
protected $conn = array();

Expand All @@ -56,10 +56,9 @@ class Client implements ServerSetting
protected $timeout = 1000;

/**
* @param array $servers An array of servers or a single server
* @param integer $timeout Timeout in microseconds
*
* @throws Net\Gearman\Exception
* @throws \Net\Gearman\Exception
* @see Net\Gearman\Connection
*/
public function __construct($timeout = 1000)
Expand Down Expand Up @@ -257,6 +256,8 @@ public function doEpoch($functionName, $workload, $epoch, $unique = null)
* @param string $functionName
* @param string $workload
* @param string $unique
* @param integer $type Type of job to run task as
* @param integer $epoch Time of job to run at (unix timestamp)
* @return Set
*/
private function createSet($functionName, $workload, $unique = null, $type = Task::JOB_NORMAL, $epoch = 0)
Expand Down Expand Up @@ -284,10 +285,10 @@ protected function generateUniqueId()
/**
* Submit a task to Gearman
*
* @param object $task Task to submit to Gearman
* @param Task $task Task to submit to Gearman
*
* @return void
* @see Net\Gearman\Task, Net\Gearman\Client::runSet()
* @see \Net\Gearman\Task, \Net\Gearman\Client::runSet()
*/
protected function submitTask(Task $task)
{
Expand Down Expand Up @@ -340,8 +341,8 @@ protected function submitTask(Task $task)
/**
* Run a set of tasks
*
* @param object $set A set of tasks to run
* @param int $timeout Time in seconds for the socket timeout. Max is 10 seconds
* @param Set $set A set of tasks to run
* @param int $timeout Time in seconds for the socket timeout. Max is 10 seconds
*
* @return void
* @see Net\Gearman\Set, Net\Gearman\Task
Expand Down Expand Up @@ -413,10 +414,10 @@ public function runSet(Set $set, $timeout = null)
*
* @param array $resp The raw array response
* @param resource $s The socket
* @param object $tasks The tasks being ran
* @param Set $tasks The tasks being ran
*
* @return void
* @throws Net\Gearman\Exception
* @throws \Net\Gearman\Exception
*/
protected function handleResponse($resp, $s, Set $tasks)
{
Expand Down
12 changes: 5 additions & 7 deletions lib/Net/Gearman/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ class Connection

/**
* Constructor
*
* @return void
*/
final private function __construct()
{
Expand All @@ -128,7 +126,7 @@ final private function __construct()
* @param int $timeout Timeout in milliseconds
*
* @return resource A connection to a Gearman server
* @throws Net\Gearman\Exception when it can't connect to server
* @throws \Net\Gearman\Exception when it can't connect to server
* @see Net\Gearman\Connection::$waiting
* @see Net\Gearman\Connection::$magic
* @see Net\Gearman\Connection::$commands
Expand Down Expand Up @@ -186,7 +184,7 @@ static public function connect($host = 'localhost', $timeout = 2000)
*
* @see Net\Gearman\Connection::$commands, Net\Gearman\Connection::$socket
* @return boolean
* @throws Net\Gearman\Exception on invalid command or unable to write
* @throws \Net\Gearman\Exception on invalid command or unable to write
*/
static public function send($socket, $command, array $params = array())
{
Expand Down Expand Up @@ -250,7 +248,7 @@ static public function send($socket, $command, array $params = array())
*
* @see Net\Gearman\Connection::$magic
* @return array Result read back from Gearman
* @throws Net\Gearman\Exception connection issues or invalid responses
* @throws \Net\Gearman\Exception connection issues or invalid responses
*/
static public function read($socket)
{
Expand Down Expand Up @@ -315,10 +313,10 @@ static public function read($socket)
* @param resource $socket The socket to read from
* @param float $timeout The timeout for the read
*
* @throws Net\Gearman\Exception on timeouts
* @throws \Net\Gearman\Exception on timeouts
* @return array
*/
static public function blockingRead($socket, $timeout = 500)
static public function blockingRead($socket, $timeout = 500.0)
{
static $cmds = array();

Expand Down
16 changes: 8 additions & 8 deletions lib/Net/Gearman/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class Manager
* @param string $server Host and port (e.g. 'localhost:7003')
* @param integer $timeout Connection timeout
*
* @throws Net\Gearman\Exception
* @see Net\Gearman\Manager::$conn
* @throws \Net\Gearman\Exception
* @see \Net\Gearman\Manager::$conn
*/
public function __construct($server, $timeout = 5)
{
Expand Down Expand Up @@ -130,7 +130,7 @@ public function shutdown($graceful = false)
* that the worker has announced.
*
* @return array A list of workers connected to the server
* @throws Net\Gearman\Exception
* @throws \Net\Gearman\Exception
*/
public function workers()
{
Expand Down Expand Up @@ -174,7 +174,7 @@ public function workers()
* @param integer $size New size of queue
*
* @return boolean
* @throws Net\Gearman\Exception
* @throws \Net\Gearman\Exception
*/
public function setMaxQueueSize($function, $size)
{
Expand All @@ -201,7 +201,7 @@ public function setMaxQueueSize($function, $size)
* that job.
*
* @return array An array keyed by function name
* @throws Net\Gearman\Exception
* @throws \Net\Gearman\Exception
*/
public function status()
{
Expand Down Expand Up @@ -233,7 +233,7 @@ public function status()
* @param string $cmd The command to send
*
* @return void
* @throws Net\Gearman\Exception
* @throws \Net\Gearman\Exception
*/
protected function sendCommand($cmd)
{
Expand All @@ -254,7 +254,7 @@ protected function sendCommand($cmd)
* in everything until ".\n". If the command being sent is NOT ended with
* ".\n" DO NOT use this command.
*
* @throws Net\Gearman\Exception
* @throws \Net\Gearman\Exception
* @return string
*/
protected function recvCommand()
Expand Down Expand Up @@ -283,7 +283,7 @@ protected function recvCommand()
* @param string $data The returned data to check for an error
*
* @return void
* @throws Net\Gearman\Exception
* @throws \Net\Gearman\Exception
*/
protected function checkForError($data)
{
Expand Down
9 changes: 4 additions & 5 deletions lib/Net/Gearman/Set.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ class Set implements \IteratorAggregate, \Countable
*
* @param array $tasks Array of tasks to run
*
* @return void
* @see \Net\Gearman\Task
*/
public function __construct(array $tasks = array())
Expand All @@ -113,9 +112,8 @@ public function __construct(array $tasks = array())
/**
* Add a task to the set
*
* @param object $task Task to add to the set
* @param Task $task Task to add to the set
*
* @return void
* @see \Net\Gearman\Task, \Net\Gearman\Set::$tasks
*/
public function addTask(Task $task)
Expand Down Expand Up @@ -160,6 +158,7 @@ public function finished()
{
if ($this->tasksCount == 0) {
if (isset($this->callback)) {
$results = array();
foreach ($this->tasks as $task) {
$results[] = $task->result;
}
Expand Down Expand Up @@ -193,11 +192,11 @@ public function attachCallback($callback)
/**
* Get the iterator
*
* @return ArrayIterator Tasks
* @return \ArrayIterator Tasks
*/
public function getIterator()
{
return new ArrayIterator($this->tasks);
return new \ArrayIterator($this->tasks);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/Net/Gearman/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,12 @@ class Task
* @param mixed $arg List of arguments for job
* @param string $uniq The unique id of the job
* @param integer $type Type of job to run task as
* @param integer $epoch Time of job to run at (unix timestamp)
*
* @return \Net\Gearman\Task
* @throws \Net\Gearman\Exception
*/
public function __construct($func, $arg, $uniq = null,
$type = self::JOB_NORMAL, $epoch = 0)
public function __construct($func, $arg, $uniq = null, $type = self::JOB_NORMAL, $epoch = 0)
{
$this->func = $func;
$this->arg = $arg;
Expand Down
19 changes: 9 additions & 10 deletions lib/Net/Gearman/Worker.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace Net\Gearman;

use Net\Gearman\Job\JobException;

/**
* Interface for Danga's Gearman job scheduling system
*
Expand Down Expand Up @@ -213,8 +215,7 @@ public function unregisterAll()
}

/**
* @throws Exception
* @return bool
* @throws \Net\Gearman\Exception
*/
public function work($monitor = null)
{
Expand Down Expand Up @@ -288,7 +289,6 @@ public function work($monitor = null)
$working = false;
}
}

}

private function connectToAllServers()
Expand Down Expand Up @@ -330,7 +330,7 @@ public function registerFunctionsToOpenedConnections()
* @param resource $socket The socket to work on
*
* @return boolean Returns true if work was done, false if not
* @throws Net_Gearman_Exception
* @throws \Net\Gearman\Exception
* @see Net_Gearman_Connection::send()
*/
protected function doWork($socket)
Expand Down Expand Up @@ -441,8 +441,7 @@ private function jobFail($socket, $handle)
* @param callback $callback
* @param int $type
*
* @throws Net\Gearman\Exception When an invalid callback is specified.
* @throws Net\Gearman\Exception When an invalid type is specified.
* @throws \Net\Gearman\Exception When an invalid callback or type is specified.
*/
public function attachCallback($callback, $type = self::JOB_COMPLETE)
{
Expand Down Expand Up @@ -480,11 +479,11 @@ protected function callCompleteCallbacks($handle, $job, $result)
}

/**
* @param string $handle The job's Gearman handle
* @param string $job The name of the job
* @param object $error The exception thrown
* @param string $handle The job's Gearman handle
* @param string $job The name of the job
* @param \Exception $error The exception thrown
*/
protected function callFailCallbacks($handle, $job, PEAR_Exception $error)
protected function callFailCallbacks($handle, $job, \Exception $error)
{
foreach ($this->callback[self::JOB_FAIL] as $callback) {
call_user_func($callback, $handle, $job, $error);
Expand Down

0 comments on commit 29d21af

Please sign in to comment.