Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
madmages committed Sep 8, 2019
1 parent 5ba58aa commit 19d4150
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/TypedClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,19 @@ private function _prepareRequest(array $requestParams): array
}

$withFiles = false;
array_walk_recursive($requestParams, function(&$item, &$withFiles)
array_walk_recursive($requestParams, function(&$item) use (&$withFiles)
{
if (!is_object($item)) {
return;
}

if ($item instanceof AbstractInputFile) {
$withFiles = true;
$item = $item->getFile();
$file = $item->getFile();
if (!is_resource($file) && is_file($file)) {
$file = fopen($file, 'rb');
}
$item = $file;
} else {
$item = json_decode($this->_getSerializer()->serialize($item, 'json'), true);
}
Expand Down

0 comments on commit 19d4150

Please sign in to comment.