GearmanWorkExecutedEvent.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. /**
  3. * Gearman Bundle for Symfony2
  4. *
  5. * For the full copyright and license information, please view the LICENSE
  6. * file that was distributed with this source code.
  7. *
  8. * Feel free to edit as you please, and have fun.
  9. *
  10. * @author Marc Morera <yuhu@mmoreram.com>
  11. */
  12. namespace Mmoreram\GearmanBundle\Event;
  13. use Symfony\Component\EventDispatcher\Event;
  14. /**
  15. * GearmanWorkExecutedEvent
  16. *
  17. * @author Dominic Grostate <codekestrel@googlemail.com>
  18. *
  19. * @since 2.4.2
  20. */
  21. class GearmanWorkExecutedEvent extends Event
  22. {
  23. /**
  24. * @var array
  25. *
  26. * Gearman jobs running
  27. */
  28. protected $jobs;
  29. /**
  30. * @var int
  31. *
  32. * Remaining iterations on work
  33. */
  34. protected $iterationsRemaining;
  35. /**
  36. * @var int
  37. *
  38. * Return code from last ran job
  39. */
  40. protected $returnCode;
  41. /**
  42. * Construct method
  43. *
  44. * @param array $jobs Jobs
  45. * @param int $iterationsRemaining Iterations Remaining
  46. * @param int $returnCode Return code
  47. */
  48. public function __construct(array $jobs, $iterationsRemaining, $returnCode)
  49. {
  50. $this->jobs = $jobs;
  51. $this->iterationsRemaining = $iterationsRemaining;
  52. $this->returnCode = $returnCode;
  53. }
  54. /**
  55. * Get Gearman Work subscribed jobs
  56. *
  57. * @return array Subscribed jobs
  58. */
  59. public function getJobs()
  60. {
  61. return $this->jobs;
  62. }
  63. /**
  64. * Get Gearman Work remaining iteration length
  65. *
  66. * @return int Remaining iterations
  67. */
  68. public function getIterationsRemaining()
  69. {
  70. return $this->iterationsRemaining;
  71. }
  72. /**
  73. * Get Gearman Job return code
  74. *
  75. * @return int Last return code
  76. */
  77. public function getReturnCode()
  78. {
  79. return $this->returnCode;
  80. }
  81. }