コード例 #1
0
ファイル: CountryRepository.php プロジェクト: msooon/hubzilla
 /**
  * Creates a country object from the provided definition.
  *
  * @param array  $definition The country definition.
  * @param string $locale     The locale of the country definition.
  *
  * @return Country
  */
 protected function createCountryFromDefinition(array $definition, $locale)
 {
     $country = new Country();
     $country->setCountryCode($definition['code']);
     $country->setName($definition['name']);
     $country->setLocale($locale);
     if (isset($definition['three_letter_code'])) {
         $country->setThreeLetterCode($definition['three_letter_code']);
     }
     if (isset($definition['numeric_code'])) {
         $country->setNumericCode($definition['numeric_code']);
     }
     if (isset($definition['telephone_code'])) {
         $country->setTelephoneCode($definition['telephone_code']);
     }
     return $country;
 }
コード例 #2
0
ファイル: CountryTest.php プロジェクト: msooon/hubzilla
 /**
  * @covers ::getCountryCode
  * @covers ::setCountryCode
  * @covers ::__toString
  */
 public function testCountryCode()
 {
     $this->country->setCountryCode('US');
     $this->assertEquals('US', $this->country->getCountryCode());
     $this->assertEquals('US', (string) $this->country);
 }