mirror of
https://github.com/flextype/flextype.git
synced 2025-08-08 22:26:46 +02:00
refactor(json): update code according to coding doctrine coding standard
This commit is contained in:
@@ -11,12 +11,13 @@ namespace Flextype\Support\Serializers;
|
||||
|
||||
use Flextype\Component\Strings\Strings;
|
||||
use RuntimeException;
|
||||
|
||||
use function defined;
|
||||
use function json_decode;
|
||||
use function json_encode;
|
||||
use function json_last_error;
|
||||
use function json_last_error_msg;
|
||||
use function md5;
|
||||
|
||||
use const JSON_PRESERVE_ZERO_FRACTION;
|
||||
use const JSON_PRETTY_PRINT;
|
||||
use const JSON_UNESCAPED_SLASHES;
|
||||
@@ -37,7 +38,7 @@ class Json
|
||||
*
|
||||
* @return mixed A JSON string representing the original PHP value
|
||||
*/
|
||||
public function encode($input, int $options = 0, int $depth = 512) : string
|
||||
public function encode($input, int $options = 0, int $depth = 512): string
|
||||
{
|
||||
return $this->_encode($input, $options, $depth);
|
||||
}
|
||||
@@ -76,7 +77,7 @@ class Json
|
||||
/**
|
||||
* @see Json::encode()
|
||||
*/
|
||||
public function _encode($input, $options = 0, int $depth = 512) : string
|
||||
public function _encode($input, $options = 0, int $depth = 512): string
|
||||
{
|
||||
$options = ($options & self::ESCAPE_UNICODE ? 0 : JSON_UNESCAPED_UNICODE)
|
||||
| JSON_UNESCAPED_SLASHES
|
||||
@@ -106,8 +107,8 @@ class Json
|
||||
return $value;
|
||||
}
|
||||
|
||||
protected function getCacheID($input)
|
||||
protected function getCacheID($input): string
|
||||
{
|
||||
Strings::hash('json' . $input);
|
||||
return Strings::hash('json' . $input);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user