Completed
Pull Request — master (#9)
by Matthew
05:40 queued 02:41
created
Tests/Model/WorkerTest.php 1 patch
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -108,6 +108,11 @@
 block discarded – undo
108 108
         }
109 109
     }
110 110
 
111
+    /**
112
+     * @param integer|null $time
113
+     * @param string $method
114
+     * @param integer $priority
115
+     */
111 116
     protected function assertJob(Job $job, $time, $method, $priority = null)
112 117
     {
113 118
         $this->assertNotEmpty($job->getId(), 'Job should have an id');
Please login to merge, or discard this patch.
DependencyInjection/Configuration.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@
 block discarded – undo
31 31
                 ->end()
32 32
                 ->arrayNode('beanstalkd')
33 33
                     ->children()
34
-                       ->scalarNode('host')->end()
35
-                       ->scalarNode('tube')->end()
34
+                        ->scalarNode('host')->end()
35
+                        ->scalarNode('tube')->end()
36 36
                     ->end()
37 37
                 ->end()
38 38
                 ->arrayNode('rabbit_mq')
Please login to merge, or discard this patch.
Command/PruneCommand.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
     }
65 65
 
66 66
     /**
67
-     * @param array           $matches
67
+     * @param string[]           $matches
68 68
      * @param OutputInterface $output
69 69
      *
70 70
      * @return int
Please login to merge, or discard this patch.
Command/RunCommand.php 2 patches
Doc Comments   +16 added lines patch added patch discarded remove patch
@@ -83,6 +83,9 @@  discard block
 block discarded – undo
83 83
             ->setDescription('Start up a job in queue');
84 84
     }
85 85
 
86
+    /**
87
+     * @param double $start
88
+     */
86 89
     protected function runJobById($start, $jobId)
87 90
     {
88 91
         $this->runStart($start);
@@ -106,6 +109,10 @@  discard block
 block discarded – undo
106 109
         return;
107 110
     }
108 111
 
112
+    /**
113
+     * @param string $varName
114
+     * @param integer $pow
115
+     */
109 116
     private function validateIntNull($varName, $var, $pow)
110 117
     {
111 118
         if (null === $var) {
@@ -122,6 +129,9 @@  discard block
 block discarded – undo
122 129
         return intval($var);
123 130
     }
124 131
 
132
+    /**
133
+     * @param string $level
134
+     */
125 135
     public function log($level, $msg, array $context = [])
126 136
     {
127 137
         if ($this->logger) {
@@ -178,6 +188,12 @@  discard block
 block discarded – undo
178 188
         return $this->runLoop($start, $workerName, $methodName, $nanoSleep, $maxCount, $duration);
179 189
     }
180 190
 
191
+    /**
192
+     * @param double $start
193
+     * @param null|integer $nanoSleep
194
+     * @param null|integer $maxCount
195
+     * @param null|integer $duration
196
+     */
181 197
     protected function runLoop($start, $workerName, $methodName, $nanoSleep, $maxCount, $duration)
182 198
     {
183 199
         $container = $this->getContainer();
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@
 block discarded – undo
172 172
         set_time_limit($processTimeout); // Set timeout on the process
173 173
 
174 174
         if ($jobId = $input->getOption('id')) {
175
-            return $this->runJobById($start, $jobId);   // Run a single job
175
+            return $this->runJobById($start, $jobId); // Run a single job
176 176
         }
177 177
 
178 178
         return $this->runLoop($start, $workerName, $methodName, $nanoSleep, $maxCount, $duration);
Please login to merge, or discard this patch.
Doctrine/BaseJobManager.php 2 patches
Doc Comments   +20 added lines patch added patch discarded remove patch
@@ -22,6 +22,12 @@  discard block
 block discarded – undo
22 22
     protected $runClass;
23 23
     protected $runArchiveClass;
24 24
 
25
+    /**
26
+     * @param string $objectName
27
+     * @param string $archiveObjectName
28
+     * @param string $runClass
29
+     * @param string $runArchiveClass
30
+     */
25 31
     public function __construct(ObjectManager $objectManager,
26 32
         $objectName,
27 33
         $archiveObjectName,
@@ -83,6 +89,9 @@  discard block
 block discarded – undo
83 89
         return $this->getObjectManager()->getRepository($this->getObjectName());
84 90
     }
85 91
 
92
+    /**
93
+     * @param string $objectName
94
+     */
86 95
     abstract protected function countJobsByStatus($objectName, $status, $workerName = null, $method = null);
87 96
 
88 97
     public function resetErroneousJobs($workerName = null, $method = null)
@@ -181,6 +190,10 @@  discard block
 block discarded – undo
181 190
         return $countProcessed;
182 191
     }
183 192
 
193
+    /**
194
+     * @param string $workerName
195
+     * @param string $method
196
+     */
184 197
     public function pruneStalledJobs($workerName = null, $method = null)
185 198
     {
186 199
         $stalledJobs = $this->getStalledJobs($workerName, $method);
@@ -246,8 +259,15 @@  discard block
 block discarded – undo
246 259
         return $job;
247 260
     }
248 261
 
262
+    /**
263
+     * @param string $objectName
264
+     */
249 265
     abstract protected function stopIdGenerator($objectName);
250 266
 
267
+    /**
268
+     * @param integer $limit
269
+     * @param integer $offset
270
+     */
251 271
     private function resetJobsByCriterion(
252 272
         $criterion,
253 273
         $limit,
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
         $countProcessed = 0;
168 168
         for ($i = 0, $count = count($stalledJobs); $i < $count; $i += static::FETCH_COUNT) {
169
-            for ($j = $i, $max = $i + static::FETCH_COUNT; $j < $max && $j < $count; ++$j ) {
169
+            for ($j = $i, $max = $i + static::FETCH_COUNT; $j < $max && $j < $count; ++$j) {
170 170
                 $job = $stalledJobs[$j];
171 171
                 /* Job $job */
172 172
                 $job->setStatus(Job::STATUS_NEW);
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 
189 189
         $countProcessed = 0;
190 190
         for ($i = 0, $count = count($stalledJobs); $i < $count; $i += static::FETCH_COUNT) {
191
-            for ($j = $i, $max = $i + static::FETCH_COUNT; $j < $max && $j < $count; ++$j ) {
191
+            for ($j = $i, $max = $i + static::FETCH_COUNT; $j < $max && $j < $count; ++$j) {
192 192
                 $job = $stalledJobs[$j];
193 193
                 $objectManager->remove($job);
194 194
                 ++$countProcessed;
Please login to merge, or discard this patch.
ODM/JobManager.php 1 patch
Doc Comments   +10 added lines patch added patch discarded remove patch
@@ -31,6 +31,9 @@  discard block
 block discarded – undo
31 31
         return $query->count();
32 32
     }
33 33
 
34
+    /**
35
+     * @param string $objectName
36
+     */
34 37
     public function stopIdGenerator($objectName)
35 38
     {
36 39
         $objectManager = $this->getObjectManager();
@@ -40,6 +43,10 @@  discard block
 block discarded – undo
40 43
         $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
41 44
     }
42 45
 
46
+    /**
47
+     * @param string $workerName
48
+     * @param string $method
49
+     */
43 50
     public function pruneErroneousJobs($workerName = null, $method = null)
44 51
     {
45 52
         /** @var DocumentManager $objectManager */
@@ -67,6 +74,8 @@  discard block
 block discarded – undo
67 74
 
68 75
     /**
69 76
      * Prunes expired jobs.
77
+     * @param string $workerName
78
+     * @param string $method
70 79
      */
71 80
     public function pruneExpiredJobs($workerName = null, $method = null)
72 81
     {
@@ -148,6 +157,7 @@  discard block
 block discarded – undo
148 157
 
149 158
     /**
150 159
      * Get Status Jobs.
160
+     * @param string $documentName
151 161
      */
152 162
     protected function getStatusByDocument($documentName)
153 163
     {
Please login to merge, or discard this patch.
ORM/JobManager.php 2 patches
Doc Comments   +12 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,6 +54,10 @@  discard block
 block discarded – undo
54 54
         return $count;
55 55
     }
56 56
 
57
+    /**
58
+     * @param string $workerName
59
+     * @param string $method
60
+     */
57 61
     public function pruneErroneousJobs($workerName = null, $method = null)
58 62
     {
59 63
         /** @var EntityManager $objectManager */
@@ -76,6 +80,10 @@  discard block
 block discarded – undo
76 80
         return $query->execute();
77 81
     }
78 82
 
83
+    /**
84
+     * @param string $workerName
85
+     * @param string $method
86
+     */
79 87
     public function pruneExpiredJobs($workerName = null, $method = null)
80 88
     {
81 89
         /** @var EntityManager $objectManager */
@@ -181,6 +189,9 @@  discard block
 block discarded – undo
181 189
         return $finalResult;
182 190
     }
183 191
 
192
+    /**
193
+     * @param string $entityName
194
+     */
184 195
     protected function getStatusByEntityName($entityName, array &$result)
185 196
     {
186 197
         /** @var EntityManager $objectManager */
@@ -207,7 +218,7 @@  discard block
 block discarded – undo
207 218
      * @param string $methodName
208 219
      * @param bool   $prioritize
209 220
      *
210
-     * @return \Dtc\QueueBundle\Model\Job|null
221
+     * @return Job|null
211 222
      */
212 223
     public function getJob($workerName = null, $methodName = null, $prioritize = true, $runId = null)
213 224
     {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@
 block discarded – undo
130 130
             if ($method) {
131 131
                 $qb->where($qb->expr()->andX(
132 132
                     $qb->expr()->eq('j.workerName', ':workerName'),
133
-                                             $qb->expr()->eq('j.method', ':method')
133
+                                                $qb->expr()->eq('j.method', ':method')
134 134
                 ))
135 135
                     ->setParameter(':method', $method);
136 136
             } else {
Please login to merge, or discard this patch.
RabbitMQ/JobManager.php 1 patch
Doc Comments   +18 added lines patch added patch discarded remove patch
@@ -29,11 +29,26 @@  discard block
 block discarded – undo
29 29
         $this->pid = getmypid();
30 30
     }
31 31
 
32
+    /**
33
+     * @param string $exchange
34
+     * @param string $type
35
+     * @param boolean $passive
36
+     * @param boolean $durable
37
+     * @param boolean $autoDelete
38
+     */
32 39
     public function setExchangeArgs($exchange, $type, $passive, $durable, $autoDelete)
33 40
     {
34 41
         $this->exchangeArgs = func_get_args();
35 42
     }
36 43
 
44
+    /**
45
+     * @param string $queue
46
+     * @param boolean $passive
47
+     * @param boolean $durable
48
+     * @param boolean $exclusive
49
+     * @param boolean $autoDelete
50
+     * @param integer $maxPriority
51
+     */
37 52
     public function setQueueArgs($queue, $passive, $durable, $exclusive, $autoDelete, $maxPriority)
38 53
     {
39 54
         $arguments = func_get_args();
@@ -106,6 +121,9 @@  discard block
 block discarded – undo
106 121
         return $job;
107 122
     }
108 123
 
124
+    /**
125
+     * @param string $workerName
126
+     */
109 127
     public function getJob($workerName = null, $methodName = null, $prioritize = true, $runId = null)
110 128
     {
111 129
         if ($methodName) {
Please login to merge, or discard this patch.
Tests/Model/BaseJobManagerTest.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -136,6 +136,9 @@
 block discarded – undo
136 136
         }
137 137
     }
138 138
 
139
+    /**
140
+     * @param string $method
141
+     */
139 142
     protected function expectingException($method)
140 143
     {
141 144
         try {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@
 block discarded – undo
156 156
 
157 157
         $start = microtime(true);
158 158
         $jobsTotal = 100; // have to trim this down as Travis is slow.
159
-        self::$jobManager->enableSorting = false;    // Ignore priority
159
+        self::$jobManager->enableSorting = false; // Ignore priority
160 160
 
161 161
         for ($i = 0; $i < $jobsTotal; ++$i) {
162 162
             $startLater = microtime(true);
Please login to merge, or discard this patch.