|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Brazanation\States; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Class State |
|
7
|
|
|
* |
|
8
|
|
|
* @package Brazanation\States |
|
9
|
|
|
* |
|
10
|
|
|
* @method static acre() Acre |
|
11
|
|
|
*/ |
|
12
|
|
|
abstract class State implements StateInterface |
|
13
|
|
|
{ |
|
14
|
|
|
private static $available = [ |
|
15
|
|
|
'Acre' => Acre::class, |
|
16
|
|
|
'Alagoas' => Alagoas::class, |
|
17
|
|
|
'Amazonas' => Amazonas::class, |
|
18
|
|
|
'Amapa' => Amapa::class, |
|
19
|
|
|
'Bahia' => Bahia::class, |
|
20
|
|
|
'Ceara' => Ceara::class, |
|
21
|
|
|
'DistritoFederal' => DistritoFederal::class, |
|
22
|
|
|
'EspiritoSanto' => EspiritoSanto::class, |
|
23
|
|
|
'Goias' => Goias::class, |
|
24
|
|
|
'Maranhao' => Maranhao::class, |
|
25
|
|
|
'MinasGerais' => MinasGerais::class, |
|
26
|
|
|
'MatoGrossoDoSul' => MatoGrossoDoSul::class, |
|
27
|
|
|
'MatoGrosso' => MatoGrosso::class, |
|
28
|
|
|
'Para' => Para::class, |
|
29
|
|
|
'Paraiba' => Paraiba::class, |
|
30
|
|
|
'Pernambuco' => Pernambuco::class, |
|
31
|
|
|
'Piaui' => Piaui::class, |
|
32
|
|
|
'Parana' => Parana::class, |
|
33
|
|
|
'RioDeJaneiro' => RioDeJaneiro::class, |
|
34
|
|
|
'RioGrandeDoNorte' => RioGrandeDoNorte::class, |
|
35
|
|
|
'Rondonia' => Rondonia::class, |
|
36
|
|
|
'Roraima' => Roraima::class, |
|
37
|
|
|
'RioGrandeDoSul' => RioGrandeDoSul::class, |
|
38
|
|
|
'SantaCatarina' => SantaCatarina::class, |
|
39
|
|
|
'Sergipe' => Sergipe::class, |
|
40
|
|
|
'SaoPaulo' => SaoPaulo::class, |
|
41
|
|
|
'Tocantins' => Tocantins::class, |
|
42
|
|
|
]; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @var string |
|
46
|
|
|
*/ |
|
47
|
|
|
public $fullName; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @var string |
|
51
|
|
|
*/ |
|
52
|
|
|
public $shortName; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @var int |
|
56
|
|
|
*/ |
|
57
|
|
|
public $code; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @var string |
|
61
|
|
|
*/ |
|
62
|
|
|
public $timeZone; |
|
63
|
|
|
|
|
64
|
29 |
|
protected function __construct($fullName, $shortName, $code, $timeZone) |
|
65
|
|
|
{ |
|
66
|
29 |
|
$this->fullName = $fullName; |
|
67
|
29 |
|
$this->shortName = $shortName; |
|
68
|
29 |
|
$this->code = $code; |
|
69
|
29 |
|
$this->timeZone = $timeZone; |
|
70
|
29 |
|
} |
|
71
|
|
|
|
|
72
|
29 |
|
public static function __callStatic($name, $args) |
|
73
|
|
|
{ |
|
74
|
29 |
|
$className = self::$available[ucfirst($name)]; |
|
75
|
|
|
|
|
76
|
29 |
|
return new $className(); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
public function equalTo(StateInterface $state) |
|
80
|
|
|
{ |
|
81
|
|
|
return ($this === $state); |
|
82
|
|
|
} |
|
83
|
|
|
} |
|
84
|
|
|
|