Method generate
has 30 lines of code (exceeds 25 allowed). Consider refactoring.
public function generate($value, $typeHint = null)
{
if (! is_string($value) || '{' !== $value[0]) {
throw new UnsupportedFormatException();
}
Method getJsonError
has 26 lines of code (exceeds 25 allowed). Consider refactoring.
private function getJsonError()
{
$error = json_last_error();
switch ($error) {
Function generate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
public function generate($value, $typeHint = null)
{
if (! is_string($value) || '{' !== $value[0]) {
throw new UnsupportedFormatException();
}
Function validate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
public function validate(array &$data)
{
parent::validate($data);
$count = count($data['value']);
Avoid too many return
statements within this method.
return 'Unknown error';
Avoid too many return
statements within this method.
return 'Malformed UTF-8 characters, possibly incorrectly encoded';
Avoid too many return
statements within this method.
return 'Unsupported type';
Avoid too many return
statements within this method.
return 'Recursive references found';
Avoid too many return
statements within this method.
return 'Syntax error, malformed JSON';
Avoid too many return
statements within this method.
return null;
Avoid too many return
statements within this method.
return 'Value includes Inf or NaN';
Function getTypeClass
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
public static function getTypeClass($type)
{
if (isset(self::$typeClassCache[$type])) {
return self::$typeClassCache[$type];
}