Skip to content

Commit 4cf4a7a

Browse files
authored
Merge pull request #96 from pagarme/develop
2 parents cec3f0e + a50aec0 commit 4cf4a7a

File tree

60 files changed

+121
-124
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+121
-124
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "pagarme/ecommerce-module-core",
33
"description": "Core component for Pagar.me e-commerce platform modules.",
44
"license": "MIT",
5-
"version": "2.2.0",
5+
"version": "2.2.1",
66
"authors": [
77
{
88
"name":"Open Source Team"

integrityDeploy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
$moduleCoreSetupReflection = new ReflectionClass($concretePlatformCoreSetupClass);
1717
$concreteCoreSetupFilename = $moduleCoreSetupReflection->getFileName();
18-
$concreteDir = explode(DIRECTORY_SEPARATOR, $concreteCoreSetupFilename);
18+
$concreteDir = explode(DIRECTORY_SEPARATOR, $concreteCoreSetupFilename ?? '');
1919
array_pop($concreteDir);
2020
$concreteDir = implode(DIRECTORY_SEPARATOR, $concreteDir);
2121

src/Hub/ValueObjects/HubInstallToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ final class HubInstallToken extends AbstractValidString
88
{
99
protected function validateValue($value)
1010
{
11-
return preg_match('/\w{64}$/', $value) === 1;
11+
return preg_match('/\w{64}$/', $value ?? '') === 1;
1212
}
1313
}

src/Kernel/Abstractions/AbstractModuleCoreSetup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public static function getModuleConcreteDir()
241241

242242
$moduleCoreSetupReflection = new ReflectionClass($concretePlatformCoreSetupClass);
243243
$concreteCoreSetupFilename = $moduleCoreSetupReflection->getFileName();
244-
$concreteDir = explode(DIRECTORY_SEPARATOR, $concreteCoreSetupFilename);
244+
$concreteDir = explode(DIRECTORY_SEPARATOR, $concreteCoreSetupFilename ?? '');
245245
array_pop($concreteDir);
246246

247247
self::$moduleConcreteDir = implode(DIRECTORY_SEPARATOR, $concreteDir);

src/Kernel/Aggregates/Configuration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ public function setAntifraudMinAmount($antifraudMinAmount)
577577
$numbers = '/([^0-9])/i';
578578
$replace = '';
579579

580-
$minAmount = preg_replace($numbers, $replace, $antifraudMinAmount);
580+
$minAmount = preg_replace($numbers, $replace, $antifraudMinAmount ?? '');
581581

582582
if ($minAmount < 0) {
583583
throw new InvalidParamException(
@@ -893,7 +893,7 @@ public function __call($method, $arguments)
893893
{
894894
$methodSplited = explode(
895895
"_",
896-
preg_replace('/(?<=\\w)(?=[A-Z])/',"_$1", $method)
896+
preg_replace('/(?<=\\w)(?=[A-Z])/',"_$1", $method ?? '')
897897
);
898898

899899
$targetObject = $this;

src/Kernel/Factories/ChargeFactory.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -126,25 +126,25 @@ private function extractTransactionsFromDbData($dbData)
126126
$transactions = [];
127127
if (isset($dbData['tran_id']) && $dbData['tran_id'] !== null) {
128128
$tranId = explode(',', $dbData['tran_id']);
129-
$tranPagarmeId = explode(',', $dbData['tran_pagarme_id']);
130-
$tranChargeId = explode(',', $dbData['tran_charge_id']);
131-
$tranAmount = explode(',', $dbData['tran_amount']);
132-
$tranPaidAmount = explode(',', $dbData['tran_paid_amount']);
133-
$tranType = explode(',', $dbData['tran_type']);
134-
$tranStatus = explode(',', $dbData['tran_status']);
135-
$tranCreatedAt = explode(',', $dbData['tran_created_at']);
136-
137-
$tranAcquirerNsu = explode(',', $dbData['tran_acquirer_nsu']);
138-
$tranAcquirerTid = explode(',', $dbData['tran_acquirer_tid']);
129+
$tranPagarmeId = explode(',', $dbData['tran_pagarme_id'] ?? '');
130+
$tranChargeId = explode(',', $dbData['tran_charge_id'] ?? '');
131+
$tranAmount = explode(',', $dbData['tran_amount'] ?? '');
132+
$tranPaidAmount = explode(',', $dbData['tran_paid_amount'] ?? '');
133+
$tranType = explode(',', $dbData['tran_type'] ?? '');
134+
$tranStatus = explode(',', $dbData['tran_status'] ?? '');
135+
$tranCreatedAt = explode(',', $dbData['tran_created_at'] ?? '');
136+
137+
$tranAcquirerNsu = explode(',', $dbData['tran_acquirer_nsu'] ?? '');
138+
$tranAcquirerTid = explode(',', $dbData['tran_acquirer_tid'] ?? '');
139139
$tranAcquirerAuthCode = explode(
140140
',',
141-
$dbData['tran_acquirer_auth_code']
142-
);
143-
$tranAcquirerName = explode(',', $dbData['tran_acquirer_name']);
144-
$tranAcquirerMessage = explode(',', $dbData['tran_acquirer_message']);
145-
$tranBoletoUrl = explode(',', $dbData['tran_boleto_url']);
146-
$tranCardData = explode('---', $dbData['tran_card_data']);
147-
$tranData = explode('---', $dbData['tran_data']);
141+
$dbData['tran_acquirer_auth_code'] ?? ''
142+
);
143+
$tranAcquirerName = explode(',', $dbData['tran_acquirer_name'] ?? '');
144+
$tranAcquirerMessage = explode(',', $dbData['tran_acquirer_message'] ?? '');
145+
$tranBoletoUrl = explode(',', $dbData['tran_boleto_url'] ?? '');
146+
$tranCardData = explode('---', $dbData['tran_card_data'] ?? '');
147+
$tranData = explode('---', $dbData['tran_data'] ?? '');
148148

149149
foreach ($tranId as $index => $id) {
150150
$transaction = [

src/Kernel/Factories/OrderFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function createFromPlatformData(
132132

133133
$order->setPagarmeId(new OrderId($orderId));
134134

135-
$baseStatus = explode('_', $platformOrder->getStatus());
135+
$baseStatus = explode('_', $platformOrder->getStatus() ?? '');
136136
$status = $baseStatus[0];
137137
for ($i = 1; $i < count($baseStatus); $i++) {
138138
$status .= ucfirst(($baseStatus[$i]));

src/Kernel/Factories/TransactionFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function createFromPostData($postData)
2020

2121
$transaction->setPagarmeId(new TransactionId($postData['id']));
2222

23-
$baseStatus = explode('_', $postData['status']);
23+
$baseStatus = explode('_', $postData['status'] ?? '');
2424
$status = $baseStatus[0];
2525
for ($i = 1; $i < count($baseStatus); $i++) {
2626
$status .= ucfirst(($baseStatus[$i]));
@@ -34,7 +34,7 @@ public function createFromPostData($postData)
3434
}
3535
$transaction->setStatus(TransactionStatus::$status());
3636

37-
$baseType = explode('_', $postData['transaction_type']);
37+
$baseType = explode('_', $postData['transaction_type'] ?? '');
3838
$type = $baseType[0];
3939
for ($i = 1; $i < count($baseType); $i++) {
4040
$type .= ucfirst(($baseType[$i]));
@@ -142,7 +142,7 @@ public function createFromDbData($dbData)
142142
$transaction->setAcquirerTid($dbData['acquirer_tid']);
143143
$transaction->setAcquirerAuthCode($dbData['acquirer_auth_code']);
144144

145-
$baseStatus = explode('_', $dbData['status']);
145+
$baseStatus = explode('_', $dbData['status'] ?? '');
146146
$status = $baseStatus[0];
147147
for ($i = 1; $i < count($baseStatus); $i++) {
148148
$status .= ucfirst(($baseStatus[$i]));
@@ -156,7 +156,7 @@ public function createFromDbData($dbData)
156156
}
157157
$transaction->setStatus(TransactionStatus::$status());
158158

159-
$baseType = explode('_', $dbData['type']);
159+
$baseType = explode('_', $dbData['type'] ?? '');
160160
$type = $baseType[0];
161161
for ($i = 1; $i < count($baseType); $i++) {
162162
$type .= ucfirst(($baseType[$i]));

src/Kernel/Helper/StringFunctionsHelper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ final public function removeSpecialCharacters($str)
132132
return preg_replace(
133133
"/[^a-zA-Z ]/",
134134
'',
135-
$str
135+
$str ?? ''
136136
);
137137
}
138138

@@ -143,7 +143,7 @@ public function cleanStrToDb($str)
143143
return str_replace(
144144
"'",
145145
"`",
146-
strip_tags($str)
146+
strip_tags($str ?? '')
147147
);
148148
}
149149

@@ -161,7 +161,7 @@ public static function removeLineBreaks($text)
161161
preg_replace(
162162
$pattern,
163163
' ',
164-
$text
164+
$text ?? ''
165165
)
166166
);
167167

src/Kernel/Log/BlurData.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class BlurData
2323
*/
2424
public function getBlurMethod(string $method)
2525
{
26-
return 'blur' . str_replace(' ', '', ucwords(str_replace('_', ' ', $method)));
26+
return 'blur' . str_replace(' ', '', ucwords(str_replace('_', ' ', $method ?? '')));
2727
}
2828

2929
/**
@@ -94,7 +94,7 @@ public function blurStreet(string $street)
9494
*/
9595
public function blurDocument(string $document)
9696
{
97-
return preg_replace('/\B[^@.]/', '*', $document);
97+
return preg_replace('/\B[^@.]/', '*', $document ?? '');
9898
}
9999

100100
/**
@@ -176,7 +176,7 @@ public function blurNeighborhood(?string $neighborhood)
176176
public function blurHolderName(?string $holderName)
177177
{
178178
$holderName = $holderName ?? "";
179-
return preg_replace('/^.{8}/', '$1**', $holderName);
179+
return preg_replace('/^.{8}/', '$1**', $holderName ?? '');
180180
}
181181

182182
/**

0 commit comments

Comments
 (0)