/** * Loads the environment names from the endpoint map. * * @return mixed True on success or a PayPal error object on failure */ function loadEnvironments() { $version = PayPal::getWSDLVersion(); $endpoints = PayPal::getEndpoints(); if (PayPal::isError($endpoints)) { return $endpoints; } foreach ($endpoints as $range) { if ($version >= $range['min'] && $version <= $range['max']) { foreach (array_keys($range['environments']) as $environment) { $this->_validEnvironments[] = strtolower($environment); } return true; } } return PayPal::raiseError("Could not find any endpoint mappings for WSDL version '{$version}'"); }