| Total Complexity | 6 |
| Total Lines | 83 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class ElementCountDown extends BaseElement |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | private static $icon = 'sectionnav-icon'; |
||
|
|
|||
| 18 | |||
| 19 | /** |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | private static $singular_name = 'Count Down Element'; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var string |
||
| 26 | */ |
||
| 27 | private static $plural_name = 'Count Down Elements'; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var array |
||
| 31 | */ |
||
| 32 | private static $db = [ |
||
| 33 | 'End' => 'DBDatetime', |
||
| 34 | 'ShowMonths' => 'Boolean', |
||
| 35 | 'ShowSeconds' => 'Boolean', |
||
| 36 | 'Elapse' => 'Boolean', |
||
| 37 | ]; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @var string |
||
| 41 | */ |
||
| 42 | private static $table_name = 'ElementCountDown'; |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @var ArrayData |
||
| 46 | */ |
||
| 47 | private $client_config; |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @return string |
||
| 51 | */ |
||
| 52 | 1 | public function getType() |
|
| 53 | { |
||
| 54 | 1 | return _t(__CLASS__ . '.BlockType', 'Count Down'); |
|
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @return $this |
||
| 59 | */ |
||
| 60 | 2 | public function setClientConfig() |
|
| 61 | { |
||
| 62 | $clientArray = [ |
||
| 63 | 2 | 'End' => $this->End, |
|
| 64 | 2 | 'Elapse' => $this->Elapse, |
|
| 65 | ]; |
||
| 66 | |||
| 67 | 2 | $this->client_config = ArrayData::create($this->encodeArrayValues($clientArray)); |
|
| 68 | |||
| 69 | 2 | return $this; |
|
| 70 | } |
||
| 71 | |||
| 72 | /** |
||
| 73 | * @return ArrayData |
||
| 74 | */ |
||
| 75 | 2 | public function getClientConfig() |
|
| 76 | { |
||
| 77 | 2 | if (!$this->client_config) { |
|
| 78 | 2 | $this->setClientConfig(); |
|
| 79 | } |
||
| 80 | |||
| 81 | 2 | return $this->client_config; |
|
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * @param $array |
||
| 86 | * @return mixed |
||
| 87 | */ |
||
| 88 | 2 | protected function encodeArrayValues($array) |
|
| 95 | } |
||
| 96 | } |
||
| 97 |