Skip to content

Commit 2ebb024

Browse files
committed
Minor tweaks and fixing tests
1 parent 110293e commit 2ebb024

10 files changed

Lines changed: 19 additions & 19 deletions

classes/Hook/HookActionOrderStatusPostUpdate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function run()
7575
if ($gaRefundSent === false) {
7676
// We refund it and set the "sent" flag to true
7777
$js = $this->getGoogleAnalytics4($this->params['id_order']);
78-
$this->context->cookie->__set('ga_admin_refund', $js);
78+
$this->context->cookie->ga_admin_refund = $js;
7979
$this->context->cookie->write();
8080

8181
// We save this information to database

classes/Hook/HookActionProductCancel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function run()
7171
$orderDetail->product_name
7272
);
7373

74-
$this->context->cookie->__set('ga_admin_refund', $js);
74+
$this->context->cookie->ga_admin_refund = $js;
7575
$this->context->cookie->write();
7676
}
7777

classes/Hook/HookActionValidateOrder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,16 @@ public function run()
6262
$order = $this->params['order'];
6363

6464
// We are checking this, because in case of multishipping, there could be multiple orders
65-
if (!empty($this->context->cookie->__get('ga_admin_order'))) {
65+
if (!empty($this->context->cookie->ga_admin_order)) {
6666
$ga_admin_order = sprintf(
6767
'%1$s,%2$s',
68-
$this->context->cookie->__get('ga_admin_order'),
68+
$this->context->cookie->ga_admin_order,
6969
$order->id
7070
);
7171
} else {
7272
$ga_admin_order = $order->id;
7373
}
74-
$this->context->cookie->__set('ga_admin_order', $ga_admin_order);
74+
$this->context->cookie->ga_admin_order = $ga_admin_order;
7575
$this->context->cookie->write();
7676
}
7777

classes/Hook/HookDisplayBackOfficeHeader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected function processFailedOrders()
103103
*/
104104
protected function processManualOrders()
105105
{
106-
$adminOrders = $this->context->cookie->__get('ga_admin_order');
106+
$adminOrders = $this->context->cookie->ga_admin_order;
107107
if (empty($adminOrders)) {
108108
return;
109109
}
@@ -115,8 +115,8 @@ protected function processManualOrders()
115115
}
116116

117117
// Clean up the cookie
118-
$this->context->cookie->__unset('ga_admin_order');
119-
$this->context->cookie->write();;
118+
unset($this->context->cookie->ga_admin_order);
119+
$this->context->cookie->write();
120120
}
121121

122122
/**

classes/Hook/HookDisplayHeader.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,6 @@ private function displayGaTag()
118118
*/
119119
public function setBackOffice($backOffice)
120120
{
121-
$this->acknowledgeBackOfficeContext($backOffice);
122-
}
123-
124-
/**
125-
* @param bool $isBackOffice
126-
*/
127-
public function acknowledgeBackOfficeContext($isBackOffice)
128-
{
129-
$this->backOffice = $isBackOffice;
121+
$this->backOffice = $backOffice;
130122
}
131123
}

ps_googleanalytics.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ public function hookDisplayAdminOrder()
129129
{
130130
$gaTagHandler = new PrestaShop\Module\Ps_Googleanalytics\Handler\GanalyticsJsHandler($this, $this->context);
131131

132-
$output = $gaTagHandler->generate($this->context->cookie->__get('ga_admin_refund'));
133-
$this->context->cookie->__unset('ga_admin_refund');
132+
$output = $gaTagHandler->generate($this->context->cookie->ga_admin_refund);
133+
unset($this->context->cookie->ga_admin_refund);
134134
$this->context->cookie->write();
135135

136136
return $output;

tests/phpstan/phpstan-1.7.6.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ parameters:
77
- '#Parameter \#1 \$idCategory of class Category constructor expects null, int given.#'
88
- '#Property TabCore\:\:\$name \(string\) does not accept array.#'
99
- '#Parameter \#1 \$id of class Currency constructor expects null, int given.#'
10+
- '#Access to an undefined property Cookie\:\:\$ga_admin_order.#'
11+
- '#Access to an undefined property Cookie\:\:\$ga_admin_refund.#'

tests/phpstan/phpstan-1.7.7.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ parameters:
55
ignoreErrors:
66
- '#PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler::uninstallModule\(\) calls parent::uninstall\(\) but PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler does not extend any class.#'
77
- '#Property TabCore\:\:\$name \(string\) does not accept array.#'
8+
- '#Access to an undefined property Cookie\:\:\$ga_admin_order.#'
9+
- '#Access to an undefined property Cookie\:\:\$ga_admin_refund.#'

tests/phpstan/phpstan-1.7.8.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ includes:
44
parameters:
55
ignoreErrors:
66
- '#PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler::uninstallModule\(\) calls parent::uninstall\(\) but PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler does not extend any class.#'
7+
- '#Access to an undefined property Cookie\:\:\$ga_admin_order.#'
8+
- '#Access to an undefined property Cookie\:\:\$ga_admin_refund.#'

tests/phpstan/phpstan-latest.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ includes:
44
parameters:
55
ignoreErrors:
66
- '#PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler::uninstallModule\(\) calls parent::uninstall\(\) but PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler does not extend any class.#'
7+
- '#Access to an undefined property Cookie\:\:\$ga_admin_order.#'
8+
- '#Access to an undefined property Cookie\:\:\$ga_admin_refund.#'

0 commit comments

Comments
 (0)