shopId = (int) $shopId; $this->apiKey = (string) $apiKey; $this->salt = (string) $salt; $this->isTest = (bool) $isTest; $this->list = []; } private function constructList($rawData) { $list = []; foreach ($rawData as $row) { $id = $row['id']; $list[$id] = $row; } return $list; } /** * Get payment list using cache. * * @param $lang * * @return array */ public function getList($lang) { if (!isset($this->list[$lang])) { $restApi = new Przelewy24RestBig($this->shopId, $this->apiKey, $this->salt, $this->isTest); $res = $restApi->paymentMethods($lang); if (isset($res['data'])) { $list = $this->constructList($res['data']); } else { $list = []; } $this->list[$lang] = $list; } return $this->list[$lang]; } }