1 | <?php |
||
12 | class HandlerBuilder |
||
13 | { |
||
14 | /** @var Driver */ |
||
15 | private $driver; |
||
16 | |||
17 | /** @var bool */ |
||
18 | private $sync; |
||
19 | |||
20 | /** @var bool */ |
||
21 | private $requeueOnFailure; |
||
22 | |||
23 | /** @var bool */ |
||
24 | private $stopOnFailure; |
||
25 | |||
26 | /** @var LoggerInterface */ |
||
27 | private $logger; |
||
28 | |||
29 | /** |
||
30 | * HandlerBuilder constructor. |
||
31 | * |
||
32 | * @param Driver $driver |
||
33 | */ |
||
34 | public function __construct(Driver $driver) |
||
45 | |||
46 | /** |
||
47 | * Build a sync Handler. |
||
48 | * |
||
49 | * @return $this |
||
50 | */ |
||
51 | public function sync() |
||
57 | |||
58 | /** |
||
59 | * Build an async Handler. |
||
60 | * |
||
61 | * @return $this |
||
62 | */ |
||
63 | public function async() |
||
69 | |||
70 | /** |
||
71 | * Must the failed message be requeued. |
||
72 | * |
||
73 | * @return $this |
||
74 | */ |
||
75 | public function doNotRequeueOnFailure() |
||
81 | |||
82 | /** |
||
83 | * Must the handler continue on failure |
||
84 | * |
||
85 | * @return $this |
||
86 | */ |
||
87 | public function continueOnFailure() |
||
93 | |||
94 | /** |
||
95 | * Set a logger. |
||
96 | * |
||
97 | * @param LoggerInterface $logger |
||
98 | * |
||
99 | * @return $this |
||
100 | */ |
||
101 | public function log(LoggerInterface $logger) |
||
107 | |||
108 | /** |
||
109 | * Build the Handler. |
||
110 | * |
||
111 | * @param QueueConsumer $consumer |
||
112 | * |
||
113 | * @return QueueHandler |
||
114 | */ |
||
115 | public function build(QueueConsumer $consumer) |
||
134 | } |
||
135 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: