public function isDSAffiliate($targetCountyCode)
  {

    $foundAffiliate = false;

    $affiliates = [
    'GB', // United Kingdom
    'UK', // United Kingdom
    'CA', // Canada
    'ID', // Indonesia
    'BW', // Botswana
    'KE', // Kenya
    'GH', // Ghana
    'NG', // Nigeria
    'CD', // Congo, The Democratic Republic of the"
    'BR', // Brazil
    'MX', // Mexico
    ];

    if (in_array($targetCountyCode, $affiliates)) {
      $affiliateURL = [
      'GB' => 'https://uk.dosomething.org',        // United Kingdom
      'UK' => 'https://uk.dosomething.org',        // United Kingdom
      'CA' => 'https://canada.dosomething.org',    // Canada
      'ID' => 'https://indonesia.dosomething.org', // Indonesia
      'BW' => 'https://botswana.dosomething.org',  // Botswana
      'KE' => 'https://kenya.dosomething.org',     // Kenya
      'GH' => 'https://ghana.dosomething.org',     // Ghana
      'NG' => 'https://nigeria.dosomething.org',   // Nigeria
      'CD' => 'https://congo.dosomething.org',     // Congo, The Democratic Republic of the"
      'BR' => 'https://brazil.dosomething.org',    // Brazil
      'MX' => 'https://mexico.dosomething.org',    // Mexico
      ];
      $foundAffiliate['url'] = $affiliateURL[$targetCountyCode];
      $this->statHat->ezCount('MB_Toolbox: isDSAffiliate Found');
    } else {
      $this->statHat->ezCount('MB_Toolbox: isDSAffiliate Not Found');
    }

    return $foundAffiliate;
  }
public function isDSAffiliate($targetCountyCode)
  {

    $foundAffiliate = false;

    $affiliates = [
    'GB', // United Kingdom
    'UK', // United Kingdom
    'CA', // Canada
    'ID', // Indonesia
    'BW', // Botswana
    'KE', // Kenya
    'GH', // Ghana
    'NG', // Nigeria
    'CD', // Congo, The Democratic Republic of the"
    'BR', // Brazil
    'MX', // Mexico
    ];

    if (in_array($targetCountyCode, $affiliates)) {
      $affiliateURL = [
      'GB' => 'https://uk.dosomething.org',        // United Kingdom
      'UK' => 'https://uk.dosomething.org',        // United Kingdom
      'CA' => 'https://canada.dosomething.org',    // Canada
      'ID' => 'https://indonesia.dosomething.org', // Indonesia
      'BW' => 'https://botswana.dosomething.org',  // Botswana
      'KE' => 'https://kenya.dosomething.org',     // Kenya
      'GH' => 'https://ghana.dosomething.org',     // Ghana
      'NG' => 'https://nigeria.dosomething.org',   // Nigeria
      'CD' => 'https://congo.dosomething.org',     // Congo, The Democratic Republic of the"
      'BR' => 'https://brazil.dosomething.org',    // Brazil
      'MX' => 'https://mexico.dosomething.org',    // Mexico
      ];
      $foundAffiliate['url'] = $affiliateURL[$targetCountyCode];
      $this->statHat->ezCount('MB_Toolbox: isDSAffiliate Found');
    } else {
      $this->statHat->ezCount('MB_Toolbox: isDSAffiliate Not Found');
    }

    return $foundAffiliate;
  }
public function isDSAffiliate ( $ targetCountyCode ) { $ foundAffiliate = false ; $ affiliates = [ 'GB' , // United Kingdom 'UK' , // United Kingdom 'CA' , // Canada 'ID' , // Indonesia 'BW' , // Botswana 'KE' , // Kenya 'GH' , // Ghana 'NG' , // Nigeria 'CD' , // Congo, The Democratic Republic of the" 'BR' , // Brazil 'MX' , // Mexico ] ; if ( in_array ( $ targetCountyCode , $ affiliates ) ) { $ affiliateURL = [ 'GB' => 'https://uk.dosomething.org' , // United Kingdom 'UK' => 'https://uk.dosomething.org' , // United Kingdom 'CA' => 'https://canada.dosomething.org' , // Canada 'ID' => 'https://indonesia.dosomething.org' , // Indonesia 'BW' => 'https://botswana.dosomething.org' , // Botswana 'KE' => 'https://kenya.dosomething.org' , // Kenya 'GH' => 'https://ghana.dosomething.org' , // Ghana 'NG' => 'https://nigeria.dosomething.org' , // Nigeria 'CD' => 'https://congo.dosomething.org' , // Congo, The Democratic Republic of the" 'BR' => 'https://brazil.dosomething.org' , // Brazil 'MX' => 'https://mexico.dosomething.org' , // Mexico ] ; $ foundAffiliate [ 'url' ] = $ affiliateURL [ $ targetCountyCode ] ; $ this -> statHat -> ezCount ( 'MB_Toolbox: isDSAffiliate Found' ) ; } else { $ this -> statHat -> ezCount ( 'MB_Toolbox: isDSAffiliate Not Found' ) ; } return $ foundAffiliate ; }
Test if country code has a  DoSomething affiliate.

Follow country code convention defined in:
http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements

@param string $targetCountyCode
Country code to check.

@return boolean/array $foundAffiliate
Test if supplied country code is a DoSomething affiliate country the URL
to the affiliate site is returned vs boolean false if match is not found.
Test if country code has a DoSomething affiliate .