Skip to content

Commit 15967ef

Browse files
committed
Update KeyInfo.php
1 parent 65276de commit 15967ef

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/Commands/KeyInfo.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -154,19 +154,22 @@ private function _getKeyLocks( \Daycry\RestServer\Entities\KeyEntity $row )
154154
// @codeCoverageIgnoreEnd
155155

156156
$r = $limit->{$this->config->configRestPetitionsTable};
157-
// @codeCoverageIgnoreStart
158-
if (!$r instanceof PetitionEntity) {
159-
$r = new PetitionEntity((array)$r);
160-
}
161-
// @codeCoverageIgnoreEnd
162-
163-
$timeLimit = ( isset( $r->time ) ) ? $r->time : 3600;
164-
if( $limit->count >= $r->limit && $limit->hour_started > (time() - $timeLimit) )
157+
if($r)
165158
{
166-
$timeLeft = $this->_getTimeLeft($limit->hour_started - (time() - $timeLimit));
167-
168-
$limit->hour_started = date('Y-m-d H:i:s', $limit->hour_started);
169-
array_push( $body, array( $timeLeft, $limit->id, $r->{$this->config->restNamespaceTable}->controller, $limit->uri, $limit->count, $limit->hour_started, $limit->created_at, $limit->updated_at, $limit->deleted_at ) );
159+
// @codeCoverageIgnoreStart
160+
if (!$r instanceof PetitionEntity) {
161+
$r = new PetitionEntity((array)$r);
162+
}
163+
// @codeCoverageIgnoreEnd
164+
165+
$timeLimit = ( isset( $r->time ) ) ? $r->time : 3600;
166+
if( $limit->count >= $r->limit && $limit->hour_started > (time() - $timeLimit) )
167+
{
168+
$timeLeft = $this->_getTimeLeft($limit->hour_started - (time() - $timeLimit));
169+
170+
$limit->hour_started = date('Y-m-d H:i:s', $limit->hour_started);
171+
array_push( $body, array( $timeLeft, $limit->id, $r->{$this->config->restNamespaceTable}->controller, $limit->uri, $limit->count, $limit->hour_started, $limit->created_at, $limit->updated_at, $limit->deleted_at ) );
172+
}
170173
}
171174
}
172175

0 commit comments

Comments
 (0)