Skip to content

Commit 01c167a

Browse files
Fix coding standards
1 parent f55f411 commit 01c167a

File tree

9 files changed

+47
-38
lines changed

9 files changed

+47
-38
lines changed

app/code/Magento/AdminAnalytics/Controller/Adminhtml/Config/DisableAdminUsage.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77

88
namespace Magento\AdminAnalytics\Controller\Adminhtml\Config;
99

10+
use Magento\AdminAnalytics\Model\ResourceModel\Viewer\Logger as NotificationLogger;
1011
use Magento\Backend\App\Action;
12+
use Magento\Config\Model\Config\Factory;
1113
use Magento\Framework\App\Action\HttpPostActionInterface;
12-
use Magento\Framework\Controller\ResultFactory;
13-
use Magento\AdminAnalytics\Model\ResourceModel\Viewer\Logger as NotificationLogger;
1414
use Magento\Framework\App\ProductMetadataInterface;
15+
use Magento\Framework\Controller\ResultFactory;
1516
use Magento\Framework\Controller\ResultInterface;
16-
use Magento\Config\Model\Config\Factory;
1717

1818
/**
19-
* Controller to record Admin analytics usage log
19+
* Controller to record Admin analytics usage log.
2020
*/
2121
class DisableAdminUsage extends Action implements HttpPostActionInterface
2222
{
@@ -56,7 +56,7 @@ public function __construct(
5656
}
5757

5858
/**
59-
* Change the value of config/admin/usage/enabled
59+
* Change the value of config/admin/usage/enabled.
6060
*/
6161
private function disableAdminUsage()
6262
{
@@ -66,7 +66,7 @@ private function disableAdminUsage()
6666
}
6767

6868
/**
69-
* Log information about the last admin usage selection
69+
* Log information about the last admin usage selection.
7070
*
7171
* @return ResultInterface
7272
*/
@@ -80,11 +80,12 @@ private function markUserNotified(): ResultInterface
8080
];
8181

8282
$resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
83+
8384
return $resultJson->setData($responseContent);
8485
}
8586

8687
/**
87-
* Log information about the last shown advertisement
88+
* Log information about the last shown advertisement.
8889
*
8990
* @return ResultInterface
9091
*/

app/code/Magento/AdminAnalytics/Controller/Adminhtml/Config/EnableAdminUsage.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77

88
namespace Magento\AdminAnalytics\Controller\Adminhtml\Config;
99

10+
use Magento\AdminAnalytics\Model\ResourceModel\Viewer\Logger as NotificationLogger;
1011
use Magento\Backend\App\Action;
12+
use Magento\Config\Model\Config\Factory;
1113
use Magento\Framework\App\Action\HttpPostActionInterface;
12-
use Magento\Framework\Controller\ResultFactory;
13-
use Magento\AdminAnalytics\Model\ResourceModel\Viewer\Logger as NotificationLogger;
1414
use Magento\Framework\App\ProductMetadataInterface;
15+
use Magento\Framework\Controller\ResultFactory;
1516
use Magento\Framework\Controller\ResultInterface;
16-
use Magento\Config\Model\Config\Factory;
1717

1818
/**
19-
* Controller to record that the current admin user has responded to Admin Analytics notice
19+
* Controller to record that the current admin user has responded to Admin Analytics notice.
2020
*/
2121
class EnableAdminUsage extends Action implements HttpPostActionInterface
2222
{
@@ -54,7 +54,7 @@ public function __construct(
5454
}
5555

5656
/**
57-
* Change the value of config/admin/usage/enabled
57+
* Change the value of config/admin/usage/enabled.
5858
*/
5959
private function enableAdminUsage()
6060
{
@@ -64,7 +64,7 @@ private function enableAdminUsage()
6464
}
6565

6666
/**
67-
* Log information about the last user response
67+
* Log information about the last user response.
6868
*
6969
* @return ResultInterface
7070
*/
@@ -74,15 +74,16 @@ private function markUserNotified(): ResultInterface
7474
'success' => $this->notificationLogger->log(
7575
$this->productMetadata->getVersion()
7676
),
77-
'error_message' => ''
77+
'error_message' => '',
7878
];
7979

8080
$resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
81+
8182
return $resultJson->setData($responseContent);
8283
}
8384

8485
/**
85-
* Log information about the last shown advertisement
86+
* Log information about the last shown advertisement.
8687
*
8788
* @return \Magento\Framework\Controller\ResultInterface
8889
*/

app/code/Magento/AdminAnalytics/Model/Condition/CanViewNotification.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
namespace Magento\AdminAnalytics\Model\Condition;
99

1010
use Magento\AdminAnalytics\Model\ResourceModel\Viewer\Logger;
11-
use Magento\Framework\View\Layout\Condition\VisibilityConditionInterface;
1211
use Magento\Framework\App\CacheInterface;
12+
use Magento\Framework\View\Layout\Condition\VisibilityConditionInterface;
1313

1414
/**
1515
* Dynamic validator for UI admin analytics notification, control UI component visibility.
@@ -24,7 +24,7 @@ class CanViewNotification implements VisibilityConditionInterface
2424
private static $conditionName = 'can_view_admin_usage_notification';
2525

2626
/**
27-
* Prefix for cache
27+
* Prefix for cache.
2828
*
2929
* @var string
3030
*/
@@ -53,7 +53,7 @@ public function __construct(
5353
}
5454

5555
/**
56-
* Validate if notification popup can be shown and set the notification flag
56+
* Validate if notification popup can be shown and set the notification flag.
5757
*
5858
* @param array $arguments Attributes from element node.
5959
* @inheritdoc
@@ -67,13 +67,15 @@ public function isVisible(array $arguments): bool
6767
if ($logExists) {
6868
$this->cacheStorage->save('log-exists', $cacheKey);
6969
}
70+
7071
return !$logExists;
7172
}
73+
7274
return false;
7375
}
7476

7577
/**
76-
* Get condition name
78+
* Get condition name.
7779
*
7880
* @return string
7981
*/

app/code/Magento/AdminAnalytics/Model/ResourceModel/Viewer/Logger.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
class Logger
2020
{
2121
/**
22-
* Admin Analytics usage version log table name
22+
* Admin Analytics usage version log table name.
2323
*/
2424
const LOG_TABLE_NAME = 'admin_analytics_usage_version_log';
2525

@@ -64,6 +64,7 @@ public function log(string $lastViewVersion): bool
6464
'last_viewed_in_version',
6565
]
6666
);
67+
6768
return true;
6869
}
6970

@@ -80,17 +81,18 @@ public function get(): Log
8081
/**
8182
* Checks is log already exists.
8283
*
83-
* @return boolean
84+
* @return bool
8485
*/
8586
public function checkLogExists(): bool
8687
{
8788
$data = $this->logFactory->create(['data' => $this->loadLatestLogData()]);
8889
$lastViewedVersion = $data->getLastViewVersion();
90+
8991
return isset($lastViewedVersion);
9092
}
9193

9294
/**
93-
* Load release notification viewer log data by last view version
95+
* Load release notification viewer log data by last view version.
9496
*
9597
* @return array
9698
*/
@@ -106,6 +108,7 @@ private function loadLatestLogData(): array
106108
if (!$data) {
107109
$data = [];
108110
}
111+
109112
return $data;
110113
}
111114
}

app/code/Magento/AdminAnalytics/Model/Viewer/Log.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
use Magento\Framework\DataObject;
1111

1212
/**
13-
* Admin Analytics log resource
13+
* Admin Analytics log resource.
1414
*/
1515
class Log extends DataObject
1616
{
1717
/**
18-
* Get log id
18+
* Get log id.
1919
*
2020
* @return int
2121
*/
@@ -25,7 +25,7 @@ public function getId() : ?int
2525
}
2626

2727
/**
28-
* Get last viewed product version
28+
* Get last viewed product version.
2929
*
3030
* @return string
3131
*/

app/code/Magento/AdminAnalytics/Test/Unit/Condition/CanViewNotificationTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ class CanViewNotificationTest extends TestCase
2121
/** @var CanViewNotification */
2222
private $canViewNotification;
2323

24-
/** @var Logger|MockObject */
24+
/** @var Logger|MockObject */
2525
private $viewerLoggerMock;
2626

2727
/** @var ProductMetadataInterface|MockObject */
2828
private $productMetadataMock;
2929

30-
/** @var Log|MockObject */
30+
/** @var Log|MockObject */
3131
private $logMock;
3232

33-
/** @var MockObject|CacheInterface $cacheStorageMock */
33+
/** @var MockObject|CacheInterface */
3434
private $cacheStorageMock;
3535

3636
protected function setUp(): void

app/code/Magento/AdminAnalytics/Ui/DataProvider/AdminUsageNotificationDataProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
namespace Magento\AdminAnalytics\Ui\DataProvider;
88

9-
use Magento\Ui\DataProvider\AbstractDataProvider;
109
use Magento\Framework\Api\Filter;
10+
use Magento\Ui\DataProvider\AbstractDataProvider;
1111

1212
/**
1313
* Data Provider for the Admin usage UI component.

app/code/Magento/AdminAnalytics/ViewModel/Metadata.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\AdminAnalytics\ViewModel;
78

8-
use Magento\Framework\App\ProductMetadataInterface;
99
use Magento\Backend\Model\Auth\Session;
10+
use Magento\Framework\App\ProductMetadataInterface;
1011
use Magento\Framework\App\State;
1112
use Magento\Framework\View\Element\Block\ArgumentInterface;
1213

1314
/**
14-
* Gets user version and mode
15+
* Gets user version and mode.
1516
*/
1617
class Metadata implements ArgumentInterface
1718
{
@@ -46,7 +47,7 @@ public function __construct(
4647
}
4748

4849
/**
49-
* Get product version
50+
* Get product version.
5051
*
5152
* @return string
5253
*/
@@ -56,16 +57,17 @@ public function getMagentoVersion() :string
5657
}
5758

5859
/**
59-
* Get current user id (hash generated from email)
60+
* Get current user id (hash generated from email).
6061
*
6162
* @return string
6263
*/
6364
public function getCurrentUser() :string
6465
{
6566
return hash('sha512', 'ADMIN_USER' . $this->authSession->getUser()->getEmail());
6667
}
68+
6769
/**
68-
* Get Magento mode that the user is using
70+
* Get Magento mode that the user is using.
6971
*
7072
* @return string
7173
*/

app/code/Magento/AdminAnalytics/ViewModel/Notification.php

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

88
namespace Magento\AdminAnalytics\ViewModel;
99

10-
use Magento\Framework\View\Element\Block\ArgumentInterface;
1110
use Magento\AdminAnalytics\Model\Condition\CanViewNotification as AdminAnalyticsNotification;
11+
use Magento\Framework\View\Element\Block\ArgumentInterface;
1212
use Magento\ReleaseNotification\Model\Condition\CanViewNotification as ReleaseNotification;
1313

1414
/**
15-
* Control display of admin analytics and release notification modals
15+
* Control display of admin analytics and release notification modals.
1616
*/
1717
class Notification implements ArgumentInterface
1818
{
@@ -39,7 +39,7 @@ public function __construct(
3939
}
4040

4141
/**
42-
* Determine if the analytics popup is visible
42+
* Determine if the analytics popup is visible.
4343
*
4444
* @return bool
4545
*/
@@ -49,7 +49,7 @@ public function isAnalyticsVisible(): bool
4949
}
5050

5151
/**
52-
* Determine if the release popup is visible
52+
* Determine if the release popup is visible.
5353
*
5454
* @return bool
5555
*/

0 commit comments

Comments
 (0)