brazanation/php-documents

missing State Registration document

tonicospinelli opened this issue · 3 comments

State Registration is so complex, because it has different numbers based on State rules.

So, what are states from Brazil?

  • AC - ACRE
  • AL - ALAGOAS
  • AM - AMAZONAS
  • AP - AMAPÁ
  • BA - BAHIA
  • CE - CEARÁ
  • DF - DISTRITO FEDERAL
  • ES - ESPÍRITO SANTO
  • GO - GOIÁS
  • MA - MARANHÃO
  • MG - MINAS GERAIS
  • MS - MATO GROSSO DO SUL
  • MT - MATO GROSSO
  • PA - PARÁ
  • PB - PARAÍBA
  • PE - PERNAMBUCO
  • PI - PIAUÍ
  • PR - PARANÁ
  • RJ - RIO DE JANEIRO
  • RN - RIO GRANDE DO NORTE
  • RO - RONDÔNIA
  • RR - RORAIMA
  • RS - RIO GRANDE DO SUL
  • SC - SANTA CATARINA
  • SE - SERGIPE
  • SP - SÃO PAULO
  • TO - TOCANTINS

I suggest implementing on IE namespace , class representing each state. And later one factory create as instantiator .

$iesp = new IE\SP($number);

@Ferreiramg I have a similar approach, but does to not using namespace, is using magic call __callStatic method to create object based on State.

$ie = new StateRegistration($number, StateRegistration::SP);

// or with facade

$ie = StateRegistration::SP($number);

fixed by #19