GearmanWorkExecutedEvent.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. * @author Dominic Grostate <codekestrel@googlemail.com>
  12. */
  13. namespace Mmoreram\GearmanBundle\Event;
  14. use Symfony\Component\EventDispatcher\Event;
  15. /**
  16. * GearmanWorkExecutedEvent
  17. *
  18. * @since 2.4.2
  19. */
  20. class GearmanWorkExecutedEvent extends Event
  21. {
  22. /**
  23. * @var array
  24. *
  25. * Gearman jobs running
  26. */
  27. protected $jobs;
  28. /**
  29. * @var int
  30. *
  31. * Remaining iterations on work
  32. */
  33. protected $iterationsRemaining;
  34. /**
  35. * @var int
  36. *
  37. * Return code from last ran job
  38. */
  39. protected $returnCode;
  40. /**
  41. * Construct method
  42. *
  43. * @param array $jobs Jobs
  44. * @param int $iterationsRemaining Iterations Remaining
  45. * @param int $returnCode Return code
  46. */
  47. public function __construct(array $jobs, $iterationsRemaining, $returnCode)
  48. {
  49. $this->jobs = $jobs;
  50. $this->iterationsRemaining = $iterationsRemaining;
  51. $this->returnCode = $returnCode;
  52. }
  53. /**
  54. * Get Gearman Work subscribed jobs
  55. *
  56. * @return array Subscribed jobs
  57. */
  58. public function getJobs()
  59. {
  60. return $this->jobs;
  61. }
  62. /**
  63. * Get Gearman Work remaining iteration length
  64. *
  65. * @return int Remaining iterations
  66. */
  67. public function getIterationsRemaining()
  68. {
  69. return $this->iterationsRemaining;
  70. }
  71. /**
  72. * Get Gearman Job return code
  73. *
  74. * @return int Last return code
  75. */
  76. public function getReturnCode()
  77. {
  78. return $this->returnCode;
  79. }
  80. }