Skip to content

Commit

Permalink
Merge pull request #4 from shetabit/analysis-zEjv4y
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
hamog authored Mar 7, 2019
2 parents 46ca669 + 0f8131e commit 86955a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,16 @@ public function toGregorian(string $jDate)
}

/**
* json_encode() for multibyte characters
* json_encode() for multibyte characters.
*
* @param array $input
*
* @return string|string[]|null
*/
public function mbJsonEncode(array $input)
{
return preg_replace_callback('/\\\\u([0-9a-zA-Z]{4})/', function ($matches) {
return mb_convert_encoding(pack('H*',$matches[1]), 'UTF-8','UTF-16');
return mb_convert_encoding(pack('H*', $matches[1]), 'UTF-8', 'UTF-16');
},
json_encode($input, JSON_UNESCAPED_UNICODE)
);
Expand Down
4 changes: 2 additions & 2 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ function to_gregorian(string $jDate)
}
}

if (! function_exists('mb_json_encode')) {
if (!function_exists('mb_json_encode')) {
/**
* json_encode() for multibyte characters
* json_encode() for multibyte characters.
*
* @param array $input
*
Expand Down

0 comments on commit 86955a4

Please # to comment.