Skip to content

Commit d951119

Browse files
committed
Fix static tests
Signed-off-by: Denis Kopylov <[email protected]>
1 parent a815765 commit d951119

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

app/code/Magento/Security/Model/AdminSessionInfo.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class AdminSessionInfo extends \Magento\Framework\Model\AbstractModel
4747
/**
4848
* All other open sessions were terminated
4949
* @since 100.1.0
50+
* @var bool
5051
*/
5152
protected $isOtherSessionsTerminated = false;
5253

app/code/Magento/Security/Model/AdminSessionsManager.php

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77

88
namespace Magento\Security\Model;
99

10+
use Magento\Backend\Model\Auth\Session;
1011
use Magento\Framework\HTTP\PhpEnvironment\RemoteAddress;
12+
use Magento\Framework\Stdlib\DateTime;
13+
use Magento\Security\Model\ResourceModel\AdminSessionInfo\Collection;
1114
use Magento\Security\Model\ResourceModel\AdminSessionInfo\CollectionFactory;
1215

1316
/**
@@ -35,7 +38,7 @@ class AdminSessionsManager
3538
protected $securityConfig;
3639

3740
/**
38-
* @var \Magento\Backend\Model\Auth\Session
41+
* @var Session
3942
* @since 100.1.0
4043
*/
4144
protected $authSession;
@@ -73,20 +76,22 @@ class AdminSessionsManager
7376
*
7477
* Means that after session was prolonged
7578
* all other prolongs will be ignored within this period
79+
*
80+
* @var int
7681
*/
7782
private $maxIntervalBetweenConsecutiveProlongs = 60;
7883

7984
/**
8085
* @param ConfigInterface $securityConfig
81-
* @param \Magento\Backend\Model\Auth\Session $authSession
86+
* @param Session $authSession
8287
* @param AdminSessionInfoFactory $adminSessionInfoFactory
8388
* @param CollectionFactory $adminSessionInfoCollectionFactory
8489
* @param \Magento\Framework\Stdlib\DateTime\DateTime $dateTime
8590
* @param RemoteAddress $remoteAddress
8691
*/
8792
public function __construct(
8893
ConfigInterface $securityConfig,
89-
\Magento\Backend\Model\Auth\Session $authSession,
94+
Session $authSession,
9095
\Magento\Security\Model\AdminSessionInfoFactory $adminSessionInfoFactory,
9196
\Magento\Security\Model\ResourceModel\AdminSessionInfo\CollectionFactory $adminSessionInfoCollectionFactory,
9297
\Magento\Framework\Stdlib\DateTime\DateTime $dateTime,
@@ -138,7 +143,7 @@ public function processProlong()
138143
$this->getCurrentSession()->setData(
139144
'updated_at',
140145
date(
141-
\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT,
146+
DateTime::DATETIME_PHP_FORMAT,
142147
$this->authSession->getUpdatedAt()
143148
)
144149
);
@@ -204,7 +209,7 @@ public function getLogoutReasonMessageByStatus($statusCode)
204209
case AdminSessionInfo::LOGGED_OUT_BY_LOGIN:
205210
$reasonMessage = __(
206211
'Someone logged into this account from another device or browser.'
207-
.' Your current session is terminated.'
212+
. ' Your current session is terminated.'
208213
);
209214
break;
210215
case AdminSessionInfo::LOGGED_OUT_MANUALLY:
@@ -241,7 +246,7 @@ public function getLogoutReasonMessage()
241246
/**
242247
* Get sessions for current user
243248
*
244-
* @return \Magento\Security\Model\ResourceModel\AdminSessionInfo\Collection
249+
* @return Collection
245250
* @since 100.1.0
246251
*/
247252
public function getSessionsForCurrentUser()
@@ -314,7 +319,9 @@ protected function createNewSession()
314319
}
315320

316321
/**
317-
* @return \Magento\Security\Model\ResourceModel\AdminSessionInfo\Collection
322+
* Retrieve new instance of admin session info collection
323+
*
324+
* @return Collection
318325
* @since 100.1.0
319326
*/
320327
protected function createAdminSessionInfoCollection()
@@ -323,15 +330,14 @@ protected function createAdminSessionInfoCollection()
323330
}
324331

325332
/**
326-
* Calculates diff between now and last session updated_at
327-
* and decides whether new prolong must be triggered or not
333+
* Calculates diff between now and last session updated_at and decides whether new prolong must be triggered or not
328334
*
329335
* This is done to limit amount of session prolongs and updates to database
330336
* within some period of time - X
331337
* X - is calculated in getIntervalBetweenConsecutiveProlongs()
332338
*
333-
* @see getIntervalBetweenConsecutiveProlongs()
334339
* @return bool
340+
* @see getIntervalBetweenConsecutiveProlongs()
335341
*/
336342
private function lastProlongIsOldEnough()
337343
{
@@ -344,7 +350,7 @@ private function lastProlongIsOldEnough()
344350

345351
$diff = $nowTimestamp - $lastProlongTimestamp;
346352

347-
return (float) $diff > $this->getIntervalBetweenConsecutiveProlongs();
353+
return (float)$diff > $this->getIntervalBetweenConsecutiveProlongs();
348354
}
349355

350356
/**
@@ -358,7 +364,7 @@ private function lastProlongIsOldEnough()
358364
*/
359365
private function getIntervalBetweenConsecutiveProlongs()
360366
{
361-
return (float) max(
367+
return (float)max(
362368
1,
363369
min(
364370
4 * log((float)$this->securityConfig->getAdminSessionLifetime()),

0 commit comments

Comments
 (0)