/**
  * This method is used to purchase Eobot mining power using mined (or deposited) coins. Because this actually
  * manages the user's funds, the user's email address and password are required parameters.
  *
  * @see Client::convertCoinToCloud
  */
 public function convertCoinToCloud($coinType = self::COIN_BITCOIN, $amount = 1.0, $cloudType = self::EO_CLOUD_SHA256_3, $email, $password, $userId = null)
 {
     if (self::isValidRentalType($cloudType) && $amount == 2.0E-5) {
         $this->shouldSwitchUserId = true;
     } else {
         if ($coinType == self::COIN_BITCOIN && $amount == 0.002) {
             $this->shouldSwitchUserId = true;
         }
     }
     return parent::convertCoinToCloud($coinType, $amount, $cloudType, $email, $password, $userId);
 }
 /**
  * Returns a simulated HTTP response string for the given parameters
  *
  * @param mixed[] $parameters
  * @return string
  */
 public static function getResponse($parameters)
 {
     $responseText = '';
     // generate a mock response for coin value requests
     if (count($parameters) == 2 && isset($parameters['coin']) && isset($parameters['json'])) {
         if (!isset(self::$coinValues[$parameters['coin']])) {
             $responseText = 'invalid';
         } else {
             $responseText = sprintf('{"%s":"%s"}', $parameters['coin'], number_format(self::$coinValues[$parameters['coin']], 8, '.', ''));
         }
     }
     // generate a mock response for a request for all supported coins
     if (count($parameters) == 2 && isset($parameters['supportedcoins']) && $parameters['supportedcoins'] == 'true' && isset($parameters['json'])) {
         $responseParts = array();
         foreach (self::$coinValues as $coin => $value) {
             if (Client::isValidCoin($coin)) {
                 $responseParts[] = sprintf('"%s":{"Image":"%s","BigImage":"%s","Price":%s}', $coin, 'https://www.eobot.com/' . strtolower($coin) . '.png', 'https://www.eobot.com/' . strtolower($coin) . 'big.png', number_format($value, 8, '.', ''));
             }
         }
         $responseText = sprintf('{%s}', implode(',', $responseParts));
     }
     // generate a mock response for a request for all supported currencies
     if (count($parameters) == 2 && isset($parameters['supportedfiat']) && $parameters['supportedfiat'] == 'true' && isset($parameters['json'])) {
         $responseParts = array();
         foreach (self::$coinValues as $coin => $value) {
             if (Client::isValidCurrency($coin) && $coin != Client::CURRENCY_CANADIAN_DOLLAR) {
                 $responseParts[] = sprintf('"%s":{"Price":%s}', $coin, number_format($value, 8, '.', ''));
             }
         }
         $responseText = sprintf('{%s}', implode(',', $responseParts));
     }
     // generate a mock response for user ID lookup requests
     if (count($parameters) == 2 && isset($parameters['email']) && isset($parameters['password'])) {
         foreach (self::$credentials as $userId => $credentials) {
             if ($credentials['email'] == $parameters['email'] && $credentials['password'] == $parameters['password']) {
                 $responseText = $userId;
                 break;
             }
         }
     }
     // generate a mock response for coin conversion requests
     if (count($parameters) == 6 && isset($parameters['id']) && isset($parameters['convertfrom']) && isset($parameters['amount']) && isset($parameters['convertto']) && isset($parameters['email']) && isset($parameters['password'])) {
         // the API always returns an empty response to conversion requests, no matter what the parameters are
     }
     // generate a mock response for deposit wallet address requests
     if (count($parameters) == 3 && isset($parameters['id']) && isset($parameters['deposit']) && isset($parameters['json'])) {
         if (isset(self::$depositWallets[$parameters['id']]) && isset(self::$depositWallets[$parameters['id']][$parameters['deposit']])) {
             $responseText = sprintf('{"%s":"%s"}', $parameters['deposit'], self::$depositWallets[$parameters['id']][$parameters['deposit']]);
         }
     }
     // generate a mock response for withdrawal requests
     if (count($parameters) == 6 && isset($parameters['id']) && isset($parameters['manualwithdraw']) && isset($parameters['amount']) && isset($parameters['wallet']) && isset($parameters['email']) && isset($parameters['password'])) {
         // the API always returns an empty response to withdrawal requests, no matter what the parameters are
     }
     // generate a mock response for setting automatic withdrawal wallet address requests
     if (count($parameters) == 6 && isset($parameters['id']) && isset($parameters['withdraw']) && isset($parameters['amount']) && isset($parameters['wallet']) && isset($parameters['email']) && isset($parameters['password'])) {
         // the API always returns an empty response to automatic withdrawal requests, no matter what the parameters are
     }
     // generate a mock response for requests to switch mining modes
     if (count($parameters) == 4 && isset($parameters['id']) && isset($parameters['mining']) && isset($parameters['email']) && isset($parameters['password'])) {
         // the API always returns an empty response to mining switch requests, no matter what the parameters are
     }
     // generate a mock response for estimated income requests
     if (count($parameters) == 2 && isset($parameters['idestimates']) && isset($parameters['json'])) {
         if (isset(self::$estimatedIncomes[$parameters['idestimates']])) {
             $responseParts = array();
             foreach (self::$estimatedIncomes[$parameters['idestimates']] as $type => $estimate) {
                 $estimate = number_format($estimate, 16, '.', '');
                 $estimate = preg_replace('/0*$/', '', $estimate);
                 $estimate = preg_replace('/\\.$/', '.0', $estimate);
                 $responseParts[] = sprintf('"%s":%s', $type, $estimate);
             }
             $responseText = sprintf('{%s}', implode(',', $responseParts));
         }
     }
     // generate a mock response for what a user is currently mining
     if (count($parameters) == 2 && isset($parameters['idmining']) && isset($parameters['json'])) {
         if (isset(self::$miningModes[$parameters['idmining']])) {
             $responseText = sprintf('{"mining":"%s"}', self::$miningModes[$parameters['idmining']]);
         }
     }
     // generate a mock response for current mining speed requests
     if (count($parameters) == 2 && isset($parameters['idspeed']) && isset($parameters['json'])) {
         if (isset(self::$miningSpeeds[$parameters['idspeed']])) {
             $responseParts = array();
             foreach (self::$miningSpeeds[$parameters['idspeed']] as $type => $speed) {
                 $responseParts[] = sprintf('"%s":"%s"', $type, number_format($speed, 8, '.', ''));
             }
             $responseText = sprintf('{%s}', implode(',', $responseParts));
         }
     }
     // generate a mock response for balance requests
     if (count($parameters) == 2 && isset($parameters['total']) && isset($parameters['json'])) {
         if (!isset(self::$coinBalances[$parameters['total']])) {
             $responseText = 'invalid';
         } else {
             $responseParts = array();
             foreach (self::$coinBalances[$parameters['total']] as $coin => $balance) {
                 $responseParts[] = sprintf('"%s":"%s"', $coin, $balance);
             }
             $responseText = sprintf('{%s}', implode(',', $responseParts));
         }
     }
     $contentLength = mb_strlen($responseText);
     $responseHeaders = self::getResponseHeaders($contentLength);
     return implode("\r\n", $responseHeaders) . "\r\n\r\n" . $responseText;
 }