/** * Obtain multiple AddressBalances resources for the given identifiers. * * @deprecated since version 1.2. Use AddressClient. * @param string[] $array * @param array $params Parameters * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param BlockCypherRestCall $restCall is the Rest Call Service that is used to make rest calls * @return AddressBalance[] */ public static function getMultiple($array, $params = array(), $apiContext = null, $restCall = null) { ArgumentArrayValidator::validate($array, 'array'); ArgumentGetParamsValidator::validate($params, 'params'); $allowedParams = array(); $params = ArgumentGetParamsValidator::sanitize($params, $allowedParams); $payLoad = ""; $addressList = implode(";", $array); $chainUrlPrefix = self::getChainUrlPrefix($apiContext); $json = self::executeCall("{$chainUrlPrefix}/addrs/{$addressList}/balance" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, null, $apiContext, $restCall); return AddressBalance::getList($json); }
/** * @return AddressBalance[] */ public function testGetMultiple() { $request = $this->operation['response']['body']; $addressArray = AddressBalance::getList($request); $addressList = array(); /** @var AddressBalance $address */ foreach ($addressArray as $address) { $addressList[] = $address->getAddress(); } $result = AddressBalance::getMultiple($addressList, array(), $this->apiContext, $this->mockBlockCypherRestCall); $this->assertNotNull($result); $this->assertContainsOnlyInstancesOf('\\BlockCypher\\Api\\AddressBalance', $result); $this->assertEquals(count($result), count($addressList)); foreach ($result as $addr) { $this->assertContains($addr->getAddress(), $addressList); } return $result; }