コード例 #1
0
ファイル: OrganizationId.php プロジェクト: hyperunknown/id
 /**
  * Set id number
  *
  * @param  string $number
  * @throws Exception\InvalidStructureException If structure is invalid
  */
 public function __construct($number)
 {
     list(, $this->serialPre, $this->serialPost, $this->checkDigit) = OrganizationId::parseStructure($number);
     if ($this->serialPre[2] < 2) {
         throw new Exception\InvalidStructureException('Third digit must be at lest 2');
     }
     $this->validateCheckDigit();
 }
コード例 #2
0
 public function testGetLegalForm()
 {
     $organizationId = new OrganizationId('232100-0016');
     $this->assertEquals(Id::LEGAL_FORM_STATE_PARISH, $organizationId->getLegalForm());
     $this->assertTrue($organizationId->isStateOrParish());
     $organizationId = new OrganizationId('502017-7753');
     $this->assertEquals(Id::LEGAL_FORM_INCORPORATED, $organizationId->getLegalForm());
     $this->assertTrue($organizationId->isIncorporated());
     $organizationId = new OrganizationId('662011-0541');
     $this->assertEquals(Id::LEGAL_FORM_PARTNERSHIP, $organizationId->getLegalForm());
     $this->assertTrue($organizationId->isPartnership());
     $organizationId = new OrganizationId('702001-7781');
     $this->assertEquals(Id::LEGAL_FORM_ASSOCIATION, $organizationId->getLegalForm());
     $this->assertTrue($organizationId->isAssociation());
     $organizationId = new OrganizationId('835000-0892');
     $this->assertEquals(Id::LEGAL_FORM_NONPROFIT, $organizationId->getLegalForm());
     $this->assertTrue($organizationId->isNonProfit());
     $organizationId = new OrganizationId('916452-6197');
     $this->assertEquals(Id::LEGAL_FORM_TRADING, $organizationId->getLegalForm());
     $this->assertTrue($organizationId->isTradingCompany());
     $organizationId = new OrganizationId('132100-0018');
     $this->assertEquals(Id::LEGAL_FORM_UNDEFINED, $organizationId->getLegalForm());
     $this->assertTrue($organizationId->isLegalFormUndefined());
 }