Skip to content

Commit 98400cd

Browse files
committed
[add] Clean html entities from strings
1 parent 1c26d43 commit 98400cd

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/BuilderAbstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function build($state = null)
5151
$order['merchant_reference'] = $reference;
5252
}
5353

54-
return $order;
54+
return Helper::removeHtmlEntities($order);
5555
}
5656

5757
public function merchant()

src/Helper.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@ public static function removeNulls($data)
4646
return $data;
4747
}
4848

49+
public static function removeHtmlEntities($data)
50+
{
51+
foreach ($data as $key => $value) {
52+
if (is_string($value)) {
53+
$data[$key] = html_entity_decode($value, ENT_COMPAT | ENT_HTML401, 'UTF-8');
54+
} else {
55+
if (is_array($value)) {
56+
$data[$key] = self::removeHtmlEntities($value);
57+
}
58+
}
59+
}
60+
return $data;
61+
}
62+
4963
public static function notNull($value1, $value2)
5064
{
5165
return is_null($value1) ? $value2 : $value1;

0 commit comments

Comments
 (0)