Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Controllers/BlackBoxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class BlackBoxController extends AbstractController
* тож і право те саме, що в менеджера на замовлення. `settings` тут
* замкнуло б кнопку від тих, хто з замовленнями й працює.
*/
private const PERMISSION = 'orders';
private const string PERMISSION = 'orders';

public function updateClientInfo(
EntityFactory $entityFactory,
Expand Down
2 changes: 1 addition & 1 deletion Extenders/BackendExtender.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function getBlackBoxOrderInfo($order)
'phone' => $firstEntry['phone_formatted'] ?? ($firstEntry['phone'] ?? null),
];
if (!empty($firstEntry['fios']) && is_array($firstEntry['fios'])) {
$clientInfo['fios'] = array_values(array_filter($firstEntry['fios'], 'strlen'));
$clientInfo['fios'] = array_values(array_filter($firstEntry['fios'], strlen(...)));
}
if (!empty($firstEntry['tracks']) && is_array($firstEntry['tracks'])) {
$clientInfo['tracks'] = [];
Expand Down
2 changes: 1 addition & 1 deletion Helpers/BlackBoxApiHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function normalizePhone(?string $phone): ?string
if ($digits === null) {
return null;
}
if (strlen($digits) === 12 && substr($digits, 0, 2) === '38') {
if (strlen($digits) === 12 && str_starts_with($digits, '38')) {
$digits = substr($digits, 2);
}
if (strlen($digits) === 9) {
Expand Down
12 changes: 6 additions & 6 deletions Init/Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ public function install()
{
$this->setBackendMainController('Admin');
$this->migrateEntityTable(BlackBoxCacheEntity::class, [
(new EntityField('id'))->setTypeInt(11)->setAutoIncrement(),
(new EntityField('phone'))->setTypeVarchar(32)->setNullable(),
(new EntityField('last_name'))->setTypeVarchar(255)->setNullable(),
(new EntityField('status'))->setTypeVarchar(32)->setNullable(),
(new EntityField('payload'))->setTypeText()->setNullable(),
(new EntityField('updated_at'))->setTypeDatetime()->setNullable(),
new EntityField('id')->setTypeInt(11)->setAutoIncrement(),
new EntityField('phone')->setTypeVarchar(32)->setNullable(),
new EntityField('last_name')->setTypeVarchar(255)->setNullable(),
new EntityField('status')->setTypeVarchar(32)->setNullable(),
new EntityField('payload')->setTypeText()->setNullable(),
new EntityField('updated_at')->setTypeDatetime()->setNullable(),
]);
}

Expand Down
2 changes: 1 addition & 1 deletion Init/module.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Okay": "4.5.3",
"version": "1.1.2",
"version": "1.1.3",
"vendor": {
"email": "devsviat@proton.me",
"site": "https://github.com/devSviat"
Expand Down
6 changes: 3 additions & 3 deletions Security/RequestOrigin.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class RequestOrigin
{
/** Порти, які в origin не пишуться. */
private const DEFAULT_PORTS = ['http' => 80, 'https' => 443];
private const array DEFAULT_PORTS = ['http' => 80, 'https' => 443];

public static function isFromThisSite(): bool
{
Expand All @@ -29,8 +29,8 @@ public static function isFromThisSite(): bool
return false;
}

$origin = isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : null;
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
$origin = $_SERVER['HTTP_ORIGIN'] ?? null;
$referer = $_SERVER['HTTP_REFERER'] ?? null;

// Origin виграє: браузер ставить його сам, а Referer ріжуть проксі
// й розширення приватності. Другий кандидат — лише коли першого немає.
Expand Down
Loading