Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
update coding standart
  • Loading branch information
ihormandzyuk committed Oct 28, 2025
commit 72914b115bc16987ad20c9a51b80018e5810b6bb
24 changes: 20 additions & 4 deletions Api/Data/SecurityStatusInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,64 @@
interface SecurityStatusInterface
{

const CODE = 'code';
const SECURITYSTATUS_ID = 'id';
public const CODE = 'code';
public const SECURITYSTATUS_ID = 'id';

/**
* Get id
*
* @return mixed
*/
public function getId();

/**
* @param $securityStatusId
* Set id
*
* @param int $securityStatusId
* @return SecurityStatusCache
*/
public function setId($securityStatusId): SecurityStatusCache;

/**
* Get code
*
* @return string
*/
public function getCode(): string;

/**
* Set code
*
* @param string $code
* @return SecurityStatusCache
*/
public function setCode(string $code): SecurityStatusCache;

/**
* Check if issue still exist
*
* @return int
*/
public function getIssueExists(): int;

/**
* @param $issueExists
* Set issue exist
*
* @param int $issueExists
* @return SecurityStatusCache
*/
public function setIssueExists(int $issueExists): SecurityStatusCache;

/**
* Get deteils
*
* @return string
*/
public function getDetails(): string;

/**
* Set details
*
* @param string $details
* @return SecurityStatusCache
*/
Expand Down
36 changes: 27 additions & 9 deletions Api/SecurityCheckerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,58 +11,76 @@
interface SecurityCheckerInterface
{

const CRITICAL = 1;
const NOTICE = 2;
const CANT_CHECK = 3;
const OK = 4;
public const CRITICAL = 1;
public const NOTICE = 2;
public const CANT_CHECK = 3;
public const OK = 4;

const XML_ADMIN_SECURITY_PASSWORD_IS_FORCED = 'admin/security/password_is_forced';
const XML_PATH_ADMIN_ACCOUNT_SHARING = 'admin/security/admin_account_sharing';
const XML_PATH_USE_SECURE_KEY = 'admin/security/use_form_key';
const XML_PATH_RECAPTCHA_ADMIN_LOGIN = 'recaptcha_backend/type_for/user_login';
const XML_PATH_RECAPTCHA_RESET_PASSWORD = 'recaptcha_backend/type_for/user_forgot_password';
public const XML_ADMIN_SECURITY_PASSWORD_IS_FORCED = 'admin/security/password_is_forced';
public const XML_PATH_ADMIN_ACCOUNT_SHARING = 'admin/security/admin_account_sharing';
public const XML_PATH_USE_SECURE_KEY = 'admin/security/use_form_key';
public const XML_PATH_RECAPTCHA_ADMIN_LOGIN = 'recaptcha_backend/type_for/user_login';
public const XML_PATH_RECAPTCHA_RESET_PASSWORD = 'recaptcha_backend/type_for/user_forgot_password';

/**
* Load cache
*
* @return mixed
*/
public function loadCache();

/**
* Update cache
*
* @return mixed
*/
public function updateCache();

/**
* Check if issue exist
*
* @return mixed
*/
public function issueExists();

/**
* Get name
*
* @return string
*/
public function getName(): string;

/**
* Get type
*
* @return int
*/
public function getType(): int;

/**
* Get position
*
* @return int
*/
public function getPosition(): int;

/**
* Get total
*
* @return int
*/
public function getTotal(): int;

/**
* Get details
*
* @return array
*/
public function getDetails(): array;

/**
* Get suggestions
*
* @return string
*/
public function getSuggestions(): string;
Expand Down
2 changes: 2 additions & 0 deletions Api/SecurityCheckerListInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
interface SecurityCheckerListInterface
{
/**
* Check security
*
* @return array
*/
public function execute(): array;
Expand Down
2 changes: 2 additions & 0 deletions Api/SecurityCheckerPoolInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
interface SecurityCheckerPoolInterface
{
/**
* Get pool
*
* @return array
*/
public function get(): array;
Expand Down
2 changes: 2 additions & 0 deletions Api/SecurityCheckerUpdateCacheInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
interface SecurityCheckerUpdateCacheInterface
{
/**
* Update cache
*
* @return mixed
*/
public function execute();
Expand Down
8 changes: 7 additions & 1 deletion Block/Adminhtml/Dashboard/SecurityStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public function __construct(
}

/**
* Is enabled
*
* @return bool
*/
public function isEnabled(): bool
Expand All @@ -54,6 +56,8 @@ public function isEnabled(): bool
}

/**
* Get security status
*
* @return false|string
*/
public function getSecurityStatus()
Expand All @@ -63,7 +67,9 @@ public function getSecurityStatus()
}

/**
* @param $securityStates
* Sort records
*
* @param array $securityStates
* @return false|string
*/
public function sort($securityStates)
Expand Down
26 changes: 21 additions & 5 deletions Block/Adminhtml/Security/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public function __construct(
}

/**
* Get issues
*
* @return DataObject
*/
public function getSecurityIssues()
Expand All @@ -45,7 +47,9 @@ public function getSecurityIssues()
}

/**
* @param $securityStates
* Sort
*
* @param array $securityStates
* @return DataObject
*/
public function sort($securityStates)
Expand Down Expand Up @@ -80,10 +84,22 @@ public function sort($securityStates)
$state->getData(SecurityCheckerInterface::OK);

if ($totalIssues != 0) {
$state->setData('critical_percent', ($state->getData(SecurityCheckerInterface::CRITICAL) / $totalIssues) * 100);
$state->setData('notice_percent', ($state->getData(SecurityCheckerInterface::NOTICE) / $totalIssues) * 100);
$state->setData('cant_check_percent', ($state->getData(SecurityCheckerInterface::CANT_CHECK) / $totalIssues) * 100);
$state->setData('resolved_percent', ($state->getData(SecurityCheckerInterface::OK) / $totalIssues) * 100);
$state->setData(
'critical_percent',
($state->getData(SecurityCheckerInterface::CRITICAL) / $totalIssues) * 100
);
$state->setData(
'notice_percent',
($state->getData(SecurityCheckerInterface::NOTICE) / $totalIssues) * 100
);
$state->setData(
'cant_check_percent',
($state->getData(SecurityCheckerInterface::CANT_CHECK) / $totalIssues) * 100
);
$state->setData(
'resolved_percent',
($state->getData(SecurityCheckerInterface::OK) / $totalIssues) * 100
);
}

return $state;
Expand Down
Loading