55use Google \Cloud \Core \Exception \ConflictException ;
66use Google \Cloud \PubSub \PubSubClient ;
77use Interop \Queue \InvalidDestinationException ;
8+ use Interop \Queue \PsrConsumer ;
89use Interop \Queue \PsrContext ;
910use Interop \Queue \PsrDestination ;
11+ use Interop \Queue \PsrMessage ;
12+ use Interop \Queue \PsrProducer ;
13+ use Interop \Queue \PsrQueue ;
14+ use Interop \Queue \PsrSubscriptionConsumer ;
15+ use Interop \Queue \PsrTopic ;
16+ use Interop \Queue \PurgeQueueNotSupportedException ;
17+ use Interop \Queue \SubscriptionConsumerNotSupportedException ;
18+ use Interop \Queue \TemporaryQueueNotSupportedException ;
1019
1120class GpsContext implements PsrContext
1221{
@@ -50,78 +59,77 @@ public function __construct($client, array $options = [])
5059 }
5160
5261 /**
53- * {@inheritdoc}
62+ * @return GpsMessage
5463 */
55- public function createMessage ($ body = '' , array $ properties = [], array $ headers = [])
64+ public function createMessage (string $ body = '' , array $ properties = [], array $ headers = []): PsrMessage
5665 {
5766 return new GpsMessage ($ body , $ properties , $ headers );
5867 }
5968
6069 /**
61- * {@inheritdoc}
70+ * @return GpsTopic
6271 */
63- public function createTopic ($ topicName )
72+ public function createTopic (string $ topicName ): PsrTopic
6473 {
6574 return new GpsTopic ($ topicName );
6675 }
6776
6877 /**
69- * {@inheritdoc}
78+ * @return GpsQueue
7079 */
71- public function createQueue ($ queueName )
80+ public function createQueue (string $ queueName ): PsrQueue
7281 {
7382 return new GpsQueue ($ queueName );
7483 }
7584
76- /**
77- * {@inheritdoc}
78- */
79- public function createTemporaryQueue ()
85+ public function createTemporaryQueue (): PsrQueue
8086 {
81- throw new \ LogicException ( ' Not implemented ' );
87+ throw TemporaryQueueNotSupportedException :: providerDoestNotSupportIt ( );
8288 }
8389
8490 /**
85- * {@inheritdoc}
91+ * @return GpsProducer
8692 */
87- public function createProducer ()
93+ public function createProducer (): PsrProducer
8894 {
8995 return new GpsProducer ($ this );
9096 }
9197
9298 /**
93- * {@inheritdoc}
99+ * @param GpsQueue|GpsTopic $destination
100+ *
101+ * @return GpsConsumer
94102 */
95- public function createConsumer (PsrDestination $ destination )
103+ public function createConsumer (PsrDestination $ destination ): PsrConsumer
96104 {
97105 InvalidDestinationException ::assertDestinationInstanceOf ($ destination , GpsQueue::class);
98106
99107 return new GpsConsumer ($ this , $ destination );
100108 }
101109
102- /**
103- * {@inheritdoc}
104- */
105- public function close ()
110+ public function close (): void
106111 {
107112 }
108113
109- /**
110- * @param GpsTopic $topic
111- */
112- public function declareTopic (GpsTopic $ topic )
114+ public function createSubscriptionConsumer (): PsrSubscriptionConsumer
115+ {
116+ throw SubscriptionConsumerNotSupportedException ::providerDoestNotSupportIt ();
117+ }
118+
119+ public function purgeQueue (PsrQueue $ queue ): void
120+ {
121+ throw PurgeQueueNotSupportedException ::providerDoestNotSupportIt ();
122+ }
123+
124+ public function declareTopic (GpsTopic $ topic ): void
113125 {
114126 try {
115127 $ this ->getClient ()->createTopic ($ topic ->getTopicName ());
116128 } catch (ConflictException $ e ) {
117129 }
118130 }
119131
120- /**
121- * @param GpsTopic $topic
122- * @param GpsQueue $queue
123- */
124- public function subscribe (GpsTopic $ topic , GpsQueue $ queue )
132+ public function subscribe (GpsTopic $ topic , GpsQueue $ queue ): void
125133 {
126134 $ this ->declareTopic ($ topic );
127135
@@ -133,10 +141,7 @@ public function subscribe(GpsTopic $topic, GpsQueue $queue)
133141 }
134142 }
135143
136- /**
137- * @return PubSubClient
138- */
139- public function getClient ()
144+ public function getClient (): PubSubClient
140145 {
141146 if (false == $ this ->client ) {
142147 $ client = call_user_func ($ this ->clientFactory );
0 commit comments