33namespace Enqueue \Pheanstalk ;
44
55use Interop \Queue \InvalidDestinationException ;
6+ use Interop \Queue \PsrConsumer ;
67use Interop \Queue \PsrContext ;
78use Interop \Queue \PsrDestination ;
9+ use Interop \Queue \PsrMessage ;
10+ use Interop \Queue \PsrProducer ;
11+ use Interop \Queue \PsrQueue ;
12+ use Interop \Queue \PsrSubscriptionConsumer ;
13+ use Interop \Queue \PsrTopic ;
14+ use Interop \Queue \PurgeQueueNotSupportedException ;
15+ use Interop \Queue \SubscriptionConsumerNotSupportedException ;
16+ use Interop \Queue \TemporaryQueueNotSupportedException ;
817use Pheanstalk \Pheanstalk ;
918
1019class PheanstalkContext implements PsrContext
@@ -14,79 +23,76 @@ class PheanstalkContext implements PsrContext
1423 */
1524 private $ pheanstalk ;
1625
17- /**
18- * @param Pheanstalk $pheanstalk
19- */
2026 public function __construct (Pheanstalk $ pheanstalk )
2127 {
2228 $ this ->pheanstalk = $ pheanstalk ;
2329 }
2430
2531 /**
26- * {@inheritdoc}
32+ * @return PheanstalkMessage
2733 */
28- public function createMessage ($ body = '' , array $ properties = [], array $ headers = [])
34+ public function createMessage (string $ body = '' , array $ properties = [], array $ headers = []): PsrMessage
2935 {
3036 return new PheanstalkMessage ($ body , $ properties , $ headers );
3137 }
3238
3339 /**
34- * {@inheritdoc}
40+ * @return PheanstalkDestination
3541 */
36- public function createTopic ($ topicName )
42+ public function createTopic (string $ topicName ): PsrTopic
3743 {
3844 return new PheanstalkDestination ($ topicName );
3945 }
4046
4147 /**
42- * {@inheritdoc}
48+ * @return PheanstalkDestination
4349 */
44- public function createQueue ($ queueName )
50+ public function createQueue (string $ queueName ): PsrQueue
4551 {
4652 return new PheanstalkDestination ($ queueName );
4753 }
4854
49- /**
50- * {@inheritdoc}
51- */
52- public function createTemporaryQueue ()
55+ public function createTemporaryQueue (): PsrQueue
5356 {
54- throw new \ LogicException ( ' Not implemented ' );
57+ throw TemporaryQueueNotSupportedException :: providerDoestNotSupportIt ( );
5558 }
5659
5760 /**
58- * {@inheritdoc}
59- *
6061 * @return PheanstalkProducer
6162 */
62- public function createProducer ()
63+ public function createProducer (): PsrProducer
6364 {
6465 return new PheanstalkProducer ($ this ->pheanstalk );
6566 }
6667
6768 /**
68- * {@inheritdoc}
69- *
7069 * @param PheanstalkDestination $destination
7170 *
7271 * @return PheanstalkConsumer
7372 */
74- public function createConsumer (PsrDestination $ destination )
73+ public function createConsumer (PsrDestination $ destination ): PsrConsumer
7574 {
7675 InvalidDestinationException ::assertDestinationInstanceOf ($ destination , PheanstalkDestination::class);
7776
7877 return new PheanstalkConsumer ($ destination , $ this ->pheanstalk );
7978 }
8079
81- public function close ()
80+ public function close (): void
8281 {
8382 $ this ->pheanstalk ->getConnection ()->disconnect ();
8483 }
8584
86- /**
87- * @return Pheanstalk
88- */
89- public function getPheanstalk ()
85+ public function createSubscriptionConsumer (): PsrSubscriptionConsumer
86+ {
87+ throw SubscriptionConsumerNotSupportedException ::providerDoestNotSupportIt ();
88+ }
89+
90+ public function purgeQueue (PsrQueue $ queue ): void
91+ {
92+ throw PurgeQueueNotSupportedException ::providerDoestNotSupportIt ();
93+ }
94+
95+ public function getPheanstalk (): Pheanstalk
9096 {
9197 return $ this ->pheanstalk ;
9298 }
0 commit comments