Skip to content

Commit df20186

Browse files
author
Sebastian Machuca
committed
Convert spaces to tabs
1 parent 8f542e5 commit df20186

File tree

5 files changed

+140
-140
lines changed

5 files changed

+140
-140
lines changed

lib/Resque/Job.php

Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ class Resque_Job implements Resque_JobInterface
2828
*/
2929
private $instance;
3030

31-
/**
32-
* @var Resque_Job_FactoryInterface
33-
*/
34-
private $jobFactory;
31+
/**
32+
* @var Resque_Job_FactoryInterface
33+
*/
34+
private $jobFactory;
3535

3636
/**
3737
* Instantiate a new instance of a job.
@@ -45,18 +45,18 @@ public function __construct($queue, $payload)
4545
$this->payload = $payload;
4646
}
4747

48-
/**
49-
* Create a new job and save it to the specified queue.
50-
*
51-
* @param string $queue The name of the queue to place the job in.
52-
* @param string $class The name of the class that contains the code to execute the job.
53-
* @param array $args Any optional arguments that should be passed when the job is executed.
54-
* @param boolean $monitor Set to true to be able to monitor the status of a job.
55-
* @param string $id Unique identifier for tracking the job. Generated if not supplied.
56-
*
57-
* @return string
58-
* @throws \InvalidArgumentException
59-
*/
48+
/**
49+
* Create a new job and save it to the specified queue.
50+
*
51+
* @param string $queue The name of the queue to place the job in.
52+
* @param string $class The name of the class that contains the code to execute the job.
53+
* @param array $args Any optional arguments that should be passed when the job is executed.
54+
* @param boolean $monitor Set to true to be able to monitor the status of a job.
55+
* @param string $id Unique identifier for tracking the job. Generated if not supplied.
56+
*
57+
* @return string
58+
* @throws \InvalidArgumentException
59+
*/
6060
public static function create($queue, $class, $args = null, $monitor = false, $id = null)
6161
{
6262
if (is_null($id)) {
@@ -82,41 +82,41 @@ public static function create($queue, $class, $args = null, $monitor = false, $i
8282
return $id;
8383
}
8484

85-
/**
86-
* Find the next available job from the specified queue and return an
87-
* instance of Resque_Job for it.
88-
*
89-
* @param string $queue The name of the queue to check for a job in.
90-
* @return false|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found.
91-
*/
92-
public static function reserve($queue)
93-
{
94-
$payload = Resque::pop($queue);
95-
if(!is_array($payload)) {
96-
return false;
97-
}
98-
99-
return new Resque_Job($queue, $payload);
100-
}
101-
102-
/**
103-
* Find the next available job from the specified queues using blocking list pop
104-
* and return an instance of Resque_Job for it.
105-
*
106-
* @param array $queues
107-
* @param int $timeout
108-
* @return false|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found.
109-
*/
110-
public static function reserveBlocking(array $queues, $timeout = null)
111-
{
112-
$item = Resque::blpop($queues, $timeout);
113-
114-
if(!is_array($item)) {
115-
return false;
116-
}
117-
118-
return new Resque_Job($item['queue'], $item['payload']);
119-
}
85+
/**
86+
* Find the next available job from the specified queue and return an
87+
* instance of Resque_Job for it.
88+
*
89+
* @param string $queue The name of the queue to check for a job in.
90+
* @return false|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found.
91+
*/
92+
public static function reserve($queue)
93+
{
94+
$payload = Resque::pop($queue);
95+
if(!is_array($payload)) {
96+
return false;
97+
}
98+
99+
return new Resque_Job($queue, $payload);
100+
}
101+
102+
/**
103+
* Find the next available job from the specified queues using blocking list pop
104+
* and return an instance of Resque_Job for it.
105+
*
106+
* @param array $queues
107+
* @param int $timeout
108+
* @return false|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found.
109+
*/
110+
public static function reserveBlocking(array $queues, $timeout = null)
111+
{
112+
$item = Resque::blpop($queues, $timeout);
113+
114+
if(!is_array($item)) {
115+
return false;
116+
}
117+
118+
return new Resque_Job($item['queue'], $item['payload']);
119+
}
120120

121121
/**
122122
* Update the status of the current job.
@@ -158,11 +158,11 @@ public function getArguments()
158158
return $this->payload['args'][0];
159159
}
160160

161-
/**
162-
* Get the instantiated object for this job that will be performing work.
163-
* @return Resque_JobInterface Instance of the object that this job belongs to.
164-
* @throws Resque_Exception
165-
*/
161+
/**
162+
* Get the instantiated object for this job that will be performing work.
163+
* @return Resque_JobInterface Instance of the object that this job belongs to.
164+
* @throws Resque_Exception
165+
*/
166166
public function getInstance()
167167
{
168168
if (!is_null($this->instance)) {
@@ -181,14 +181,14 @@ public function getInstance()
181181
);
182182
}
183183

184-
if ($this->jobFactory !== null) {
185-
$this->instance = $this->jobFactory->create($this->payload['class'], $this->getArguments(), $this->queue);
186-
return $this->instance;
187-
}
188-
$this->instance = new $this->payload['class'];
189-
$this->instance->job = $this;
190-
$this->instance->args = $this->getArguments();
191-
$this->instance->queue = $this->queue;
184+
if ($this->jobFactory !== null) {
185+
$this->instance = $this->jobFactory->create($this->payload['class'], $this->getArguments(), $this->queue);
186+
return $this->instance;
187+
}
188+
$this->instance = new $this->payload['class'];
189+
$this->instance->job = $this;
190+
$this->instance->args = $this->getArguments();
191+
$this->instance->queue = $this->queue;
192192

193193
return $this->instance;
194194
}
@@ -284,14 +284,14 @@ public function __toString()
284284
return '(' . implode(' | ', $name) . ')';
285285
}
286286

287-
/**
288-
* @param Resque_Job_FactoryInterface $jobFactory
289-
* @return Resque_Job
290-
*/
291-
public function setJobFactory(Resque_Job_FactoryInterface $jobFactory)
292-
{
293-
$this->jobFactory = $jobFactory;
287+
/**
288+
* @param Resque_Job_FactoryInterface $jobFactory
289+
* @return Resque_Job
290+
*/
291+
public function setJobFactory(Resque_Job_FactoryInterface $jobFactory)
292+
{
293+
$this->jobFactory = $jobFactory;
294294

295-
return $this;
296-
}
295+
return $this;
296+
}
297297
}

lib/Resque/Job/FactoryInterface.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
interface Resque_Job_FactoryInterface
44
{
5-
/**
6-
* @param $className
7-
* @param array $args
8-
* @param $queue
9-
* @return Resque_JobInterface
10-
*/
11-
public function create($className, array $args, $queue);
5+
/**
6+
* @param $className
7+
* @param array $args
8+
* @param $queue
9+
* @return Resque_JobInterface
10+
*/
11+
public function create($className, array $args, $queue);
1212
}

lib/Resque/JobInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
interface Resque_JobInterface
44
{
5-
/**
6-
* @return bool
7-
*/
8-
public function perform();
5+
/**
6+
* @return bool
7+
*/
8+
public function perform();
99
}

test/Resque/Tests/JobTest.php

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,16 @@ public function testNamespaceNaming() {
183183

184184
public function testJobWithNamespace()
185185
{
186-
Resque_Redis::prefix('php');
187-
$queue = 'jobs';
188-
$payload = array('another_value');
189-
Resque::enqueue($queue, 'Test_Job_With_TearDown', $payload);
190-
191-
$this->assertEquals(Resque::queues(), array('jobs'));
192-
$this->assertEquals(Resque::size($queue), 1);
193-
194-
Resque_Redis::prefix('resque');
195-
$this->assertEquals(Resque::size($queue), 0);
186+
Resque_Redis::prefix('php');
187+
$queue = 'jobs';
188+
$payload = array('another_value');
189+
Resque::enqueue($queue, 'Test_Job_With_TearDown', $payload);
190+
191+
$this->assertEquals(Resque::queues(), array('jobs'));
192+
$this->assertEquals(Resque::size($queue), 1);
193+
194+
Resque_Redis::prefix('resque');
195+
$this->assertEquals(Resque::size($queue), 0);
196196
}
197197

198198
public function testDequeueAll()
@@ -363,56 +363,56 @@ public function testDequeueItemWithiWrongArg()
363363
}
364364

365365
public function testUseFactoryToGetJobInstance()
366-
{
367-
$payload = array(
368-
'class' => 'Some_Job_Class',
369-
'args' => null
370-
);
371-
$job = new Resque_Job('jobs', $payload);
372-
$factory = new Some_Stub_Factory();
373-
$job->setJobFactory($factory);
374-
$instance = $job->getInstance();
375-
$this->assertInstanceOf('Resque_JobInterface', $instance);
376-
}
377-
378-
public function testDoNotUseFactoryToGetInstance()
379-
{
380-
$payload = array(
381-
'class' => 'Some_Job_Class',
382-
'args' => null
383-
);
384-
$job = new Resque_Job('jobs', $payload);
385-
$factory = $this->getMock('Resque_Job_FactoryInterface');
386-
$testJob = $this->getMock('Resque_JobInterface');
387-
$factory->expects(self::never())->method('create')->will(self::returnValue($testJob));
388-
$instance = $job->getInstance();
389-
$this->assertInstanceOf('Resque_JobInterface', $instance);
390-
}
366+
{
367+
$payload = array(
368+
'class' => 'Some_Job_Class',
369+
'args' => null
370+
);
371+
$job = new Resque_Job('jobs', $payload);
372+
$factory = new Some_Stub_Factory();
373+
$job->setJobFactory($factory);
374+
$instance = $job->getInstance();
375+
$this->assertInstanceOf('Resque_JobInterface', $instance);
376+
}
377+
378+
public function testDoNotUseFactoryToGetInstance()
379+
{
380+
$payload = array(
381+
'class' => 'Some_Job_Class',
382+
'args' => null
383+
);
384+
$job = new Resque_Job('jobs', $payload);
385+
$factory = $this->getMock('Resque_Job_FactoryInterface');
386+
$testJob = $this->getMock('Resque_JobInterface');
387+
$factory->expects(self::never())->method('create')->will(self::returnValue($testJob));
388+
$instance = $job->getInstance();
389+
$this->assertInstanceOf('Resque_JobInterface', $instance);
390+
}
391391
}
392392

393393
class Some_Job_Class implements Resque_JobInterface
394394
{
395395

396-
/**
397-
* @return bool
398-
*/
399-
public function perform()
400-
{
401-
return true;
402-
}
396+
/**
397+
* @return bool
398+
*/
399+
public function perform()
400+
{
401+
return true;
402+
}
403403
}
404404

405405
class Some_Stub_Factory implements Resque_Job_FactoryInterface
406406
{
407407

408-
/**
409-
* @param $className
410-
* @param array $args
411-
* @param $queue
412-
* @return Resque_JobInterface
413-
*/
414-
public function create($className, array $args, $queue)
415-
{
416-
return new Some_Job_Class();
417-
}
408+
/**
409+
* @param $className
410+
* @param array $args
411+
* @param $queue
412+
* @return Resque_JobInterface
413+
*/
414+
public function create($className, array $args, $queue)
415+
{
416+
return new Some_Job_Class();
417+
}
418418
}

test/Resque/Tests/TestCase.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ class Resque_Tests_TestCase extends PHPUnit_Framework_TestCase
1111
protected $resque;
1212
protected $redis;
1313

14-
public static function setUpBeforeClass()
15-
{
16-
date_default_timezone_set('UTC');
17-
}
14+
public static function setUpBeforeClass()
15+
{
16+
date_default_timezone_set('UTC');
17+
}
1818

1919
public function setUp()
2020
{

0 commit comments

Comments
 (0)