Skip to content
This repository was archived by the owner on Feb 7, 2022. It is now read-only.

Commit 6557b80

Browse files
committed
job got an interface
1 parent f6ce3ad commit 6557b80

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

src/Job.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
namespace dmank\gearman;
33

4-
class Job
4+
class Job implements JobInterface
55
{
66
private $workLoad;
77

src/JobHandlerInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
interface JobHandlerInterface
55
{
66
/**
7-
* @param Job $job
7+
* @param JobInterface $job
88
* @return mixed
99
*/
10-
public function execute(Job $job);
10+
public function execute(JobInterface $job);
1111
}

src/JobInterface.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
namespace dmank\gearman;
3+
4+
interface JobInterface
5+
{
6+
public function getJobName();
7+
public function getWorkLoad();
8+
}

src/event/FunctionEvent.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
use dmank\gearman\Job;
55
use dmank\gearman\JobHandlerInterface;
6+
use dmank\gearman\JobInterface;
67
use Symfony\Component\EventDispatcher\Event;
78

89
class FunctionEvent extends Event
@@ -13,7 +14,7 @@ class FunctionEvent extends Event
1314
private $jobHandler;
1415
private $job;
1516

16-
public function __construct(JobHandlerInterface $jobHandler, Job $job)
17+
public function __construct(JobHandlerInterface $jobHandler, JobInterface $job)
1718
{
1819
$this->jobHandler = $jobHandler;
1920
$this->job = $job;
@@ -28,7 +29,7 @@ public function getJobHandler()
2829
}
2930

3031
/**
31-
* @return Job
32+
* @return JobInterface
3233
*/
3334
public function getJob()
3435
{

src/event/FunctionFailureEvent.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
namespace dmank\gearman\event;
33

4-
use dmank\gearman\Job;
54
use dmank\gearman\JobHandlerInterface;
5+
use dmank\gearman\JobInterface;
66
use Symfony\Component\EventDispatcher\Event;
77

88
class FunctionFailureEvent extends Event
@@ -15,7 +15,7 @@ class FunctionFailureEvent extends Event
1515
private $jobHandler;
1616

1717
/**
18-
* @var Job|null
18+
* @var JobInterface|null
1919
*/
2020
private $job;
2121

@@ -24,7 +24,7 @@ class FunctionFailureEvent extends Event
2424
*/
2525
private $exception;
2626

27-
public function __construct(JobHandlerInterface $jobHandler, \Exception $exception, Job $job = null)
27+
public function __construct(JobHandlerInterface $jobHandler, \Exception $exception, JobInterface $job = null)
2828
{
2929
$this->jobHandler = $jobHandler;
3030
$this->exception = $exception;
@@ -40,7 +40,7 @@ public function getJobHandler()
4040
}
4141

4242
/**
43-
* @return Job|null
43+
* @return JobInterface|null
4444
*/
4545
public function getJob()
4646
{

0 commit comments

Comments
 (0)