@@ -81,7 +81,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n
8181 }
8282 }
8383 } else {
84- foreach ($ data as $ property => $ value ) {
84+ foreach ($ data as $ property => $ value ) {
8585 $ values [$ property ] = self ::sanitizeForSerialization ($ value );
8686 }
8787 }
@@ -117,9 +117,7 @@ public static function sanitizeFilename($filename)
117117 */
118118 public static function sanitizeTimestamp ($ timestamp )
119119 {
120- if (!is_string ($ timestamp )) {
121- return $ timestamp ;
122- }
120+ if (!is_string ($ timestamp )) return $ timestamp ;
123121
124122 return preg_replace ('/(:\d{2}.\d{6})\d*/ ' , '$1 ' , $ timestamp );
125123 }
@@ -236,30 +234,6 @@ public static function deserialize($data, $class, $httpHeaders = null)
236234 }
237235 }
238236
239- if ($ class === '\SplFileObject ' ) {
240- $ data = Utils::streamFor ($ data );
241-
242- /** @var \Psr\Http\Message\StreamInterface $data */
243-
244- // determine file name
245- if (is_array ($ httpHeaders )
246- && array_key_exists ('Content-Disposition ' , $ httpHeaders )
247- && preg_match ('/inline; filename=[ \'"]?([^ \'"\s]+)[ \'"]?$/i ' , $ httpHeaders ['Content-Disposition ' ], $ match )
248- ) {
249- $ filename = Configuration::getDefaultConfiguration ()->getTempFolderPath () . DIRECTORY_SEPARATOR . self ::sanitizeFilename ($ match [1 ]);
250- } else {
251- $ filename = tempnam (Configuration::getDefaultConfiguration ()->getTempFolderPath (), '' );
252- }
253-
254- $ file = fopen ($ filename , 'w ' );
255- while ($ chunk = $ data ->read (200 )) {
256- fwrite ($ file , $ chunk );
257- }
258- fclose ($ file );
259-
260- return new \SplFileObject ($ filename , 'r ' );
261- }
262-
263237 /** @psalm-suppress ParadoxicalCondition */
264238 if (in_array ($ class , ['\DateTime ' , '\SplFileObject ' , 'array ' , 'bool ' , 'boolean ' , 'byte ' , 'double ' , 'float ' , 'int ' , 'integer ' , 'mixed ' , 'number ' , 'object ' , 'string ' , 'void ' ], true )) {
265239 settype ($ data , $ class );
0 commit comments