protected function internalFetch() { $params = ['SteamID' => $this->steamId64]; $result = WebApi::getJSONData("IEconItems_{$this->getAppId()}", 'GetPlayerItems', 1, $params); $this->items = []; $this->preliminaryItems = []; foreach ($result->items as $itemData) { if ($itemData != null) { $inventoryClass = get_called_class(); $itemClass = $inventoryClass::ITEM_CLASS; $item = new $itemClass($this, $itemData); if ($item->isPreliminary()) { $this->preliminaryItems[] = $item; } else { $this->items[$item->getBackpackPosition() - 1] = $item; } } } } /** * Returns the number of items in the user's backpack * * @return int The number of items in the backpack */ public function size() { return sizeof($this->items); } } GameInventory::initialize();