1: <?php
2:
3: /**
4: * Avisota newsletter and mailing system
5: *
6: * PHP Version 5.3
7: *
8: * @copyright bit3 UG 2013
9: * @author Tristan Lins <tristan.lins@bit3.de>
10: * @package avisota-core
11: * @license LGPL-3.0+
12: * @link http://avisota.org
13: */
14:
15: namespace Avisota\Test\Queue;
16:
17: use Avisota\Message\MessageInterface;
18: use Avisota\Queue\ExecutionDeciderInterface;
19:
20: class TestQueueExecutionDecider implements ExecutionDeciderInterface
21: {
22: protected $hits = 0;
23:
24: protected $accept;
25:
26: function __construct($accept)
27: {
28: $this->accept = (bool) $accept;
29: }
30:
31: /**
32: * @return mixed
33: */
34: public function getHits()
35: {
36: return $this->hits;
37: }
38:
39: /**
40: * Check if the message is accepted.
41: *
42: * @param MessageInterface $message
43: *
44: * @return bool
45: */
46: public function accept(MessageInterface $message)
47: {
48: $this->hits ++;
49: return $this->accept;
50: }
51: }
52: