示例#1
0
 /**
  * Getter for the singleton instance.
  *
  * @return NostoDotEnv the singleton instance.
  */
 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new NostoDotEnv();
     }
     return self::$instance;
 }
示例#2
0
 /**
  * Tests a .env file.
  */
 public function testDotEnvFile()
 {
     $dotEnv = NostoDotEnv::getInstance();
     $dotEnv->init(__DIR__ . '/../_support', '.env-test');
     $this->specify('dot-env variable TEST_VARIABLE assigned to $_ENV', function () {
         $this->assertArrayHasKey('TEST_VARIABLE', $_ENV);
         $this->assertEquals('test', $_ENV['TEST_VARIABLE']);
     });
     $this->specify('dot-env variable TEST_VARIABLE_QUOTED_VALUE assigned to $_ENV', function () {
         $this->assertArrayHasKey('TEST_VARIABLE_QUOTED_VALUE', $_ENV);
         $this->assertEquals('test', $_ENV['TEST_VARIABLE_QUOTED_VALUE']);
     });
     $this->specify('dot-env variable TEST_VARIABLE_NESTED assigned to $_ENV', function () {
         $this->assertArrayHasKey('TEST_VARIABLE_NESTED', $_ENV);
         $this->assertEquals('test/test', $_ENV['TEST_VARIABLE_NESTED']);
     });
 }
示例#3
0
require_once dirname(__FILE__) . '/classes/Nosto.php';
require_once dirname(__FILE__) . '/classes/NostoAccount.php';
require_once dirname(__FILE__) . '/classes/NostoAccountMeta.php';
require_once dirname(__FILE__) . '/classes/NostoCipher.php';
require_once dirname(__FILE__) . '/classes/NostoDotEnv.php';
require_once dirname(__FILE__) . '/classes/NostoMessage.php';
require_once dirname(__FILE__) . '/classes/NostoOrderConfirmation.php';
require_once dirname(__FILE__) . '/classes/NostoProductReCrawl.php';
require_once dirname(__FILE__) . '/classes/NostoValidator.php';
require_once dirname(__FILE__) . '/classes/NostoExchangeRate.php';
require_once dirname(__FILE__) . '/classes/NostoCurrency.php';
require_once dirname(__FILE__) . '/classes/NostoCurrencyCode.php';
require_once dirname(__FILE__) . '/classes/NostoCurrencySymbol.php';
require_once dirname(__FILE__) . '/classes/NostoCurrencyFormat.php';
require_once dirname(__FILE__) . '/classes/NostoCurrencyInfo.php';
// Libs
require_once dirname(__FILE__) . '/libs/phpseclib/crypt/NostoCryptBase.php';
require_once dirname(__FILE__) . '/libs/phpseclib/crypt/NostoCryptRijndael.php';
require_once dirname(__FILE__) . '/libs/phpseclib/crypt/NostoCryptAES.php';
require_once dirname(__FILE__) . '/libs/phpseclib/crypt/NostoCryptRandom.php';
// Parse .env if exists and assign configured environment variables.
NostoDotEnv::getInstance()->init(dirname(__FILE__));
if (isset($_ENV['NOSTO_API_BASE_URL'])) {
    NostoApiRequest::$baseUrl = $_ENV['NOSTO_API_BASE_URL'];
}
if (isset($_ENV['NOSTO_OAUTH_BASE_URL'])) {
    NostoOAuthClient::$baseUrl = $_ENV['NOSTO_OAUTH_BASE_URL'];
}
if (isset($_ENV['NOSTO_WEB_HOOK_BASE_URL'])) {
    NostoHttpRequest::$baseUrl = $_ENV['NOSTO_WEB_HOOK_BASE_URL'];
}
示例#4
0
require_once dirname(__FILE__) . '/src/Order/Serializer/Array.php';
require_once dirname(__FILE__) . '/src/Order/Serializer/Json.php';
require_once dirname(__FILE__) . '/src/Order/Payment/Provider.php';
require_once dirname(__FILE__) . '/src/Price/Format.php';
require_once dirname(__FILE__) . '/src/Product/Collection/Serializer/Json.php';
require_once dirname(__FILE__) . '/src/Product/Serializer/Array.php';
require_once dirname(__FILE__) . '/src/Product/Availability.php';
require_once dirname(__FILE__) . '/src/Product/Price/Variation.php';
require_once dirname(__FILE__) . '/src/Service/Currency/Exchange/Rate.php';
require_once dirname(__FILE__) . '/src/Service/Account.php';
require_once dirname(__FILE__) . '/src/Service/Order.php';
require_once dirname(__FILE__) . '/src/Service/Product.php';
require_once dirname(__FILE__) . '/src/Service/Recrawl.php';
require_once dirname(__FILE__) . '/lib/phpseclib/Crypt/Base.php';
require_once dirname(__FILE__) . '/lib/phpseclib/Crypt/Rijndael.php';
require_once dirname(__FILE__) . '/lib/phpseclib/Crypt/AES.php';
require_once dirname(__FILE__) . '/lib/phpseclib/Crypt/Hash.php';
require_once dirname(__FILE__) . '/lib/phpseclib/Crypt/Random.php';
require_once dirname(__FILE__) . '/lib/phpseclib/Math/BigInteger.php';
// Parse .env if exists and assign configured environment variables.
$dotEnv = new NostoDotEnv();
$dotEnv->init(dirname(__FILE__));
if (isset($_ENV['NOSTO_API_BASE_URL'])) {
    NostoApiRequest::$baseUrl = $_ENV['NOSTO_API_BASE_URL'];
}
if (isset($_ENV['NOSTO_OAUTH_BASE_URL'])) {
    NostoOAuthClient::$baseUrl = $_ENV['NOSTO_OAUTH_BASE_URL'];
}
if (isset($_ENV['NOSTO_WEB_HOOK_BASE_URL'])) {
    NostoHttpRequest::$baseUrl = $_ENV['NOSTO_WEB_HOOK_BASE_URL'];
}