for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Gearman Bundle for Symfony2 / Symfony3
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* Feel free to edit as you please, and have fun.
* @author Marc Morera <[email protected]>
*/
namespace Mkk\GearmanBundle\Module;
use Mkk\GearmanBundle\Module\JobClass as Job;
* Job Collection class
class JobCollection
{
* @var array
* All jobs from worker
private $workerJobs = array();
* Adds into $workerJobs a Job instance
* Return self object
* @param Job $workJob Class to add into array
* @return JobCollection
public function add(Job $workJob)
$this->workerJobs[] = $workJob;
return $this;
}
* Retrieve all Jobs added previously
* @return array
public function getJobs()
return $this->workerJobs;
* Retrieve all jobs loaded previously in cache format
public function toArray()
$jobs = array();
foreach ($this->workerJobs as $job) {
$jobs[] = $job->toArray();
return $jobs;