You are here

public static function Braintree_Configuration::caFile in Commerce Braintree 7

sets the physical path for the location of the CA certs

@access public @static

Parameters

none:

Return value

string filepath

2 calls to Braintree_Configuration::caFile()
Braintree_ConfigurationTest::testCaFile in braintree_php/tests/unit/ConfigurationTest.php
Braintree_Http::_doRequest in braintree_php/lib/Braintree/Http.php

File

braintree_php/lib/Braintree/Configuration.php, line 221

Class

Braintree_Configuration
acts as a registry for config data.

Code

public static function caFile($sslPath = NULL) {
  $sslPath = $sslPath ? $sslPath : DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'ssl' . DIRECTORY_SEPARATOR;
  switch (self::environment()) {
    case 'production':
      $caPath = realpath(dirname(__FILE__) . $sslPath . 'www_braintreegateway_com.ca.crt');
      break;
    case 'qa':
    case 'sandbox':
    default:
      $caPath = realpath(dirname(__FILE__) . $sslPath . 'sandbox_braintreegateway_com.ca.crt');
      break;
  }
  if (!file_exists($caPath)) {
    throw new Braintree_Exception_SSLCaFileNotFound();
  }
  return $caPath;
}