예제 #1
0
 /**
  * Loads HTTP data.
  * @return void
  */
 public function loadHttpData()
 {
     $countryCode = $this->getHttpData(Form::DATA_TEXT);
     $stateCode = $this->getHttpData(Form::DATA_TEXT, '_states');
     if (strlen($countryCode) !== 0 && strlen($stateCode) === 0) {
         $stateCode = NULL;
     } elseif (strlen($countryCode) === 0 && strlen($stateCode) === 0) {
         $countryCode = NULL;
         $stateCode = NULL;
     }
     $country = $this->loader->loadCountry($countryCode);
     $state = $this->loader->loadSubdivision($countryCode . '-' . $stateCode);
     $this->countryCode = $country === NULL ? NULL : $countryCode;
     $this->stateCode = $state === NULL ? NULL : $stateCode;
 }
예제 #2
0
 /**
  * Make sure that we can retrieve a specific subdivision.
  *
  * In addition to verifying that the subdivision is returned, we also need
  * to make sure that all of the data has been properly set. Also, if a
  * subdivision is not found, nothing (`null`) should be returned.
  */
 public function testLoadSubdivision()
 {
     $this->checkSubdivision($this->loader->loadSubdivision('US-CA'));
     $this->assertNull($this->loader->loadSubdivision('TEST'), 'No subdivision should be returned.');
 }