shopId = $shopId; } public static function id($shopid): self { return new self($shopid); } private function showGoods(): string { if ($this->categoryType) { $stmt = Db::getInstance()->ofetchAll('select * from items inner join trade_offers on id = shop_item_id where shop_id = ? and shop_item_quantity !=0 and item_type = ?', [$this->shopId, $this->categoryType]); $stmt2 = Db::getInstance()->ofetchAll('select * from inventory where on_sale != 0 and present is null and item_type = ?', $this->categoryType); } else { $stmt = Db::getInstance()->ofetchAll('select * from items inner join trade_offers on id = shop_item_id where shop_id = ? and shop_item_quantity !=0', $this->shopId); $stmt2 = Db::getInstance()->ofetchAll('select * from inventory where on_sale != 0 and present is null'); } $iteminfo = []; foreach ($stmt as $item) { $iteminfo[] = new ShopItem($item, 'buyshop'); } foreach ($stmt2 as $item) { $iteminfo[] = new ShopItem($item, 'buymarket'); } return $this->strFromArr($iteminfo); } private function showUserSellItems(): string { $stmt = Db::getInstance()->ofetchall('select * from inventory where on_sale = 0 and dressed_slot = 0 and durability > 0 and owner_id = ?', User::getInstance()->getId()); $iteminfo = []; $operationType = 'sellshop'; if ($this->categoryType === self::BARTER_SHOP) { $operationType = 'setmarket'; } foreach ($stmt as $item) { $iteminfo[] = new ShopItem($item, $operationType); } return $this->strFromArr($iteminfo); } private function strFromArr(array $array): string { $str = ''; $format = '