Skip to content

Commit b07e820

Browse files
committed
Resolve confict
1 parent bebb231 commit b07e820

1 file changed

Lines changed: 18 additions & 12 deletions

File tree

src/Database/Barry/Model.php

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,12 +1017,7 @@ private function executeDataCasting(string $name): mixed
10171017
if (is_object($value)) {
10181018
return (object) $value;
10191019
}
1020-
return json_decode(
1021-
$value,
1022-
false,
1023-
512,
1024-
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_INVALID_UTF8_IGNORE
1025-
);
1020+
return $this->parseToJson($value);
10261021
}
10271022

10281023
if ($type === "array") {
@@ -1032,14 +1027,25 @@ private function executeDataCasting(string $name): mixed
10321027
if (is_object($value)) {
10331028
return (array) $value;
10341029
}
1035-
return json_decode(
1036-
$value,
1037-
true,
1038-
512,
1039-
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_INVALID_UTF8_IGNORE
1040-
);
1030+
return $this->parseToJson($value);
10411031
}
10421032

10431033
return $this->attributes[$name];
10441034
}
1035+
1036+
/**
1037+
* Parse value to json
1038+
*
1039+
* @param string $value
1040+
* @return void
1041+
*/
1042+
private function parseToJson($value)
1043+
{
1044+
return json_decode(
1045+
$value,
1046+
false,
1047+
512,
1048+
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_INVALID_UTF8_IGNORE
1049+
);
1050+
}
10451051
}

0 commit comments

Comments
 (0)