1 | <?php |
||
21 | class Contingency |
||
22 | { |
||
23 | |||
24 | const SVSP = 'SVSP'; |
||
25 | const SVRS = 'SVRS'; |
||
26 | |||
27 | |||
28 | /** |
||
29 | * @var \stdClass |
||
30 | */ |
||
31 | protected $config; |
||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | public $type = ''; |
||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | public $motive = ''; |
||
40 | /** |
||
41 | * @var int |
||
42 | */ |
||
43 | public $timestamp = 0; |
||
44 | /** |
||
45 | * @var int |
||
46 | */ |
||
47 | public $tpEmis = 1; |
||
48 | |||
49 | /** |
||
50 | * Constructor |
||
51 | * @param string $contingency |
||
52 | */ |
||
53 | public function __construct($contingency = '') |
||
60 | |||
61 | /** |
||
62 | * Load json string with contingency configurations |
||
63 | * @param string $contingency |
||
64 | * @return void |
||
65 | */ |
||
66 | public function load($contingency) |
||
74 | |||
75 | /** |
||
76 | * Create a object with contingency data |
||
77 | * @param string $acronym Sigla do estado |
||
78 | * @param string $motive |
||
79 | * @param string $type Opcional parameter only used if FS-DA, EPEC or OFFLINE |
||
80 | * @return string |
||
81 | */ |
||
82 | public function activate($acronym, $motive, $type = '') |
||
122 | |||
123 | /** |
||
124 | * Deactivate contingency mode |
||
125 | * @return string |
||
126 | */ |
||
127 | public function deactivate() |
||
136 | |||
137 | /** |
||
138 | * Returns a json string format |
||
139 | * @return string |
||
140 | */ |
||
141 | public function __toString() |
||
145 | |||
146 | /** |
||
147 | * Build parameter config as stdClass |
||
148 | * @param int $timestamp |
||
149 | * @param string $motive |
||
150 | * @param string $type |
||
151 | * @return \stdClass |
||
152 | */ |
||
153 | private function configBuild($timestamp, $motive, $type) |
||
182 | } |
||
183 |