Skip to content

Commit b9e003a

Browse files
committed
Fixed counters (#19)
1 parent da4ce41 commit b9e003a

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/records/PushRecord.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Yii;
1111
use yii\base\InvalidArgumentException;
1212
use yii\db\ActiveRecord;
13+
use yii\helpers\ArrayHelper;
1314
use yii\helpers\Json;
1415
use yii\queue\JobInterface;
1516
use yii\queue\Queue;
@@ -145,7 +146,7 @@ public function getExecTotal()
145146
*/
146147
public function getAttemptCount()
147148
{
148-
return $this->execTotal['attempts'] ?: 0;
149+
return ArrayHelper::getValue($this->execTotal, 'attempts', 0);
149150
}
150151

151152
/**
@@ -187,7 +188,7 @@ public function getStatus()
187188
}
188189
return null;
189190
}
190-
191+
191192
public function getStatusLabel($label)
192193
{
193194
$labels = [

src/records/WorkerRecord.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Yii;
1111
use yii\db\ActiveRecord;
12+
use yii\helpers\ArrayHelper;
1213
use zhuravljov\yii\queue\monitor\Env;
1314
use zhuravljov\yii\queue\monitor\Module;
1415

@@ -113,15 +114,15 @@ public function getExecTotal()
113114
*/
114115
public function getExecTotalStarted()
115116
{
116-
return $this->execTotal['started'] ?: 0;
117+
return ArrayHelper::getValue($this->execTotal, 'started', 0);
117118
}
118119

119120
/**
120121
* @return int
121122
*/
122123
public function getExecTotalDone()
123124
{
124-
return $this->execTotal['done'] ?: 0;
125+
return ArrayHelper::getValue($this->execTotal, 'done', 0);
125126
}
126127

127128
/**

tests/docker/php/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:7.3
1+
FROM php:7.4
22
RUN apt-get update \
33
&& apt-get install -y curl \
44
&& apt-get install -y libzip-dev \

0 commit comments

Comments
 (0)