Example #1
0
 /**
  * @param $appId
  * @param $steamID
  * @return array
  */
 public function getRawPlayerInventory($appId, $steamID)
 {
     if (isset(self::$inventories[$steamID]) && !empty(self::$inventories[$steamID])) {
         return self::$inventories[$steamID];
     }
     Debugbar::startMeasure('getRawInventory', 'Получаем инвентарь');
     $appContext = ItemStorage::getItemContextID($appId);
     $url = $this->communityURL . 'profiles/' . $steamID . '/inventory/json/' . $appId . '/' . $appContext . '?l=russian';
     $json = $this->getPage($url);
     Debugbar::stopMeasure('getRawInventory');
     Debugbar::startMeasure('parseRawInventory', 'Декодируем инвентарь');
     $result = json_decode($json, true);
     if (!$result['success']) {
         Debugbar::stopMeasure('parseRawInventory');
         Debugbar::warning('Ошибка парсинга инвентаря!');
         Debugbar::info($result);
         return [];
     }
     self::$inventories[$steamID] = $result;
     Debugbar::stopMeasure('parseRawInventory');
     return $result;
 }