@@ 92-97 (lines=6) @@ | ||
89 | public function removeByteOrderMark($string) |
|
90 | { |
|
91 | // Check arguments |
|
92 | if (!is_string($string)) { |
|
93 | throw new InvalidArgumentException( |
|
94 | sprintf("String expected for argument '%s'. Got '%s'.", 'string', gettype($string)), |
|
95 | 1478195910 |
|
96 | ); |
|
97 | } |
|
98 | ||
99 | return (string)preg_replace( |
|
100 | '/^(?:' . |
@@ 75-80 (lines=6) @@ | ||
72 | public function getEncoding($json) |
|
73 | { |
|
74 | // Check arguments |
|
75 | if (!is_string($json)) { |
|
76 | throw new InvalidArgumentException( |
|
77 | sprintf("String expected for argument '%s'. Got '%s'.", 'json', gettype($json)), |
|
78 | 1478195652 |
|
79 | ); |
|
80 | } |
|
81 | ||
82 | // Get the first bytes |
|
83 | // (do not use str_* function here because of possible mb_str_* overloading) |
|
@@ 152-157 (lines=6) @@ | ||
149 | public function decode($json, $assoc = false, $depth = 512, $options = 0) |
|
150 | { |
|
151 | // Check arguments |
|
152 | if (!is_string($json)) { |
|
153 | throw new InvalidArgumentException( |
|
154 | sprintf("String expected for argument '%s'. Got '%s'.", 'json', gettype($json)), |
|
155 | 1478418105 |
|
156 | ); |
|
157 | } |
|
158 | if (!is_bool($assoc)) { |
|
159 | throw new InvalidArgumentException( |
|
160 | sprintf("Boolean expected for argument '%s'. Got '%s'.", 'assoc', gettype($assoc)), |