public function updateItem(Item $item, $user = null, $account = null, $releaseAmount = null) { $payload = ''; $preparePayload = array('id' => $item->getId(), 'user' => $user, 'amount' => $item->getAmount(), 'name' => $item->getName(), 'account' => $account, 'release_amount' => $releaseAmount, 'description' => $item->getDescription(), 'buyer_id' => $item->getBuyerId(), 'seller_id' => $item->getSellerId()); array_shift($preparePayload); foreach ($preparePayload as $key => $value) { $payload .= $key . '='; $payload .= urlencode($value); $payload .= "&"; } $response = $this->RestClient('patch', 'items/' . $item->getId() . '?' . $payload); // return $response; $jsonData = json_decode($response->raw_body, true); if (array_key_exists("errors", $jsonData)) { $errors = new Errors($jsonData); return $errors; } else { $jsonData = $jsonData['items']; $editedItem = new Item($jsonData); return $editedItem; } }