示例#1
0
 /**
  * @param string  $strTld
  * @param boolean $booIntranet
  * @param boolean $booTrue
  *
  * @covers Etechnika\ExtLib\Domain\TldUtils::isValid
  * @dataProvider providerIsValid
  */
 public function testIsValid($strTld, $booIntranet, $booTrue)
 {
     if ($booTrue) {
         $this->assertTrue(TldUtils::isValid($strTld, $booIntranet), 'Tld name: ' . $strTld . ' intranet: ' . var_export($booIntranet, true));
     } else {
         $this->assertFalse(TldUtils::isValid($strTld, $booIntranet), 'Tld name: ' . $strTld . ' intranet: ' . var_export($booIntranet, true));
     }
 }
示例#2
0
文件: Tld.php 项目: etechnika/ext-lib
 /**
  * Construct
  *
  * @param String  $strTld
  * @param boolean $booIntranet
  *
  * @throws InvalidTldException
  */
 public function __construct($strTld, $booIntranet = false)
 {
     $strTld = TldUtils::removeDot($strTld);
     if (!TldUtils::isValid($strTld, $booIntranet)) {
         throw new InvalidTldException('Invalid tld "' . var_export($strTld, true) . '"');
     }
     $this->strName = strtolower($strTld);
 }