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

Commit 40614ad

Browse files
digitalcharacterdominikmank
authored andcommitted
Add method to get a special jobhandler from jobcollection (#8)
* add optional parameter to function event add job result to after execute event * pecl install gearman failure * pecl install gearman failure * pecl install gearman failure * GearmanJob->sendComplete() - Object error * Get special job from JobCollection
1 parent 6c24757 commit 40614ad

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/JobCollection.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,29 @@ public function addMultipleJobs(array $jobs)
4343
}
4444

4545
/**
46-
* @return array of JobHandler
46+
* @return JobHandlerInterface[]
4747
*/
4848
public function getJobs()
4949
{
5050
return $this->jobs;
5151
}
5252

53+
/**
54+
* @param $jobName
55+
* @return JobHandlerInterface|null
56+
*/
57+
public function getJob($jobName)
58+
{
59+
/** @var JobHandlerInterface $job */
60+
foreach ($this->getJobs() as $job) {
61+
if ($job->listensToJob() === $jobName) {
62+
return $job;
63+
}
64+
}
65+
66+
return null;
67+
}
68+
5369
/**
5470
* @return int
5571
*/

0 commit comments

Comments
 (0)