Completed
Push — master ( c8d791...d93d25 )
by Gaetano
09:14
created
Adapter/SQS/Producer.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,6 @@
 block discarded – undo
48 48
     }
49 49
 
50 50
     /**
51
-     * @param string $queueName NB: complete queue name as used by SQS
52 51
      * @return Producer
53 52
      * @todo test that we can successfully send messages to 2 queues using the same SqsClient
54 53
      */
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
         for ($i = 0; $i < count($messages); $i += 10) {
99 99
             $entries = array();
100 100
             $toSend = array_slice($messages, $i, 10);
101
-            foreach($toSend as $message) {
101
+            foreach ($toSend as $message) {
102 102
                 $entries[] = array_merge(
103 103
                     array(
104 104
                         'MessageBody' => $message['msgBody'],
Please login to merge, or discard this patch.
Adapter/SQS/Consumer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function setCallback($callback)
94 94
     {
95
-        if (! $callback instanceof \Kaliop\QueueingBundle\Queue\MessageConsumerInterface) {
95
+        if (!$callback instanceof \Kaliop\QueueingBundle\Queue\MessageConsumerInterface) {
96 96
             throw new \RuntimeException('Can not set callback to SQS Consumer, as it is not a MessageConsumerInterface');
97 97
         }
98 98
         $this->callback = $callback;
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      * @param int $timeout seconds
129 129
      * @return nothing
130 130
      */
131
-    public function consume($amount, $timeout=0)
131
+    public function consume($amount, $timeout = 0)
132 132
     {
133 133
         $limit = ($amount > 0) ? $amount : $this->requestBatchSize;
134 134
         if ($timeout > 0) {
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
             'MessageAttributeNames' => array('All')
144 144
         );
145 145
 
146
-        while(true) {
146
+        while (true) {
147 147
             $reqTime = microtime(true);
148 148
 
149 149
             if ($timeout > 0) {
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
             $messages = $result->get('Messages');
156 156
 
157 157
             if (is_array($messages)) {
158
-                foreach($messages as $message) {
158
+                foreach ($messages as $message) {
159 159
 
160 160
                     // How we implement routing keys with SQS: since it is not supported natively, we check if the route
161 161
                     // matches after having downloaded the message. If it does not match, we just skip processing it.
162 162
                     // Since we will not call deleteMessage, SQS will requeue the message in a short time.
163 163
                     // This is far from optimal, but it might be better than nothing
164
-                    if (! $this->matchRoutingKey($message)) {
164
+                    if (!$this->matchRoutingKey($message)) {
165 165
                         continue;
166 166
                     }
167 167
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                     $data = $message['Body'];
175 175
                     unset($message['Body']);
176 176
 
177
-                    $contentType = isset( $message['MessageAttributes'][$this->contentTypeAttribute]['StringValue'] ) ?
177
+                    $contentType = isset($message['MessageAttributes'][$this->contentTypeAttribute]['StringValue']) ?
178 178
                         $message['MessageAttributes'][$this->contentTypeAttribute]['StringValue'] : '';
179 179
 
180 180
                     if ($contentType != '') {
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
             pcntl_signal_dispatch();
283 283
         }
284 284
 
285
-        if ($this->memoryLimit > 0 && !$this->forceStop && memory_get_usage(true) >= ($this->memoryLimit * 1024 * 1024) ) {
285
+        if ($this->memoryLimit > 0 && !$this->forceStop && memory_get_usage(true) >= ($this->memoryLimit * 1024 * 1024)) {
286 286
             $this->forceStop("Memory limit of {$this->memoryLimit} MB reached while consuming messages");
287 287
         }
288 288
 
Please login to merge, or discard this patch.
Adapter/SQS/QueueManager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         return array('list-available', 'list-configured', 'create', 'info', 'purge', 'delete');
44 44
     }
45 45
 
46
-    public function executeAction($action, array $arguments=array())
46
+    public function executeAction($action, array $arguments = array())
47 47
     {
48 48
         switch ($action) {
49 49
             case 'list-available':
@@ -145,11 +145,11 @@  discard block
 block discarded – undo
145 145
 
146 146
     protected function getProducerService()
147 147
     {
148
-        return $this->container->get('kaliop_queueing.sqs.'. $this->queueName . '_producer');
148
+        return $this->container->get('kaliop_queueing.sqs.'.$this->queueName.'_producer');
149 149
     }
150 150
 
151 151
     public function registerQueue($queueName)
152 152
     {
153
-        $this->registeredQueues[]=$queueName;
153
+        $this->registeredQueues[] = $queueName;
154 154
     }
155 155
 }
Please login to merge, or discard this patch.
Adapter/SQS/Driver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @param string $scope
102 102
      * @return mixed
103 103
      */
104
-    public function createProducer($queueName, $queueUrl, $connectionId, $scope=ContainerInterface::SCOPE_CONTAINER)
104
+    public function createProducer($queueName, $queueUrl, $connectionId, $scope = ContainerInterface::SCOPE_CONTAINER)
105 105
     {
106 106
         $class = $this->container->getParameter('kaliop_queueing.sqs.producer.class');
107 107
         $producer = new $class($this->getConnectionConfig($connectionId));
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      * @param string $scope
122 122
      * @return Consumer
123 123
      */
124
-    public function createConsumer($queueName, $queueUrl, $connectionId, $callback=null, $routingKey=null, $scope=ContainerInterface::SCOPE_CONTAINER)
124
+    public function createConsumer($queueName, $queueUrl, $connectionId, $callback = null, $routingKey = null, $scope = ContainerInterface::SCOPE_CONTAINER)
125 125
     {
126 126
         $class = $this->container->getParameter('kaliop_queueing.sqs.consumer.class');
127 127
         $consumer = new $class($this->getConnectionConfig($connectionId));
Please login to merge, or discard this patch.