-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHtmlInputModel.php
More file actions
38 lines (33 loc) · 875 Bytes
/
Copy pathHtmlInputModel.php
File metadata and controls
38 lines (33 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace universal;
/**
* Every setting is keeped in separated class, based
* on this model
*/
abstract class HtmlInputModel extends IterableTycClass {
protected $humanName;
protected $code;
protected $value;
/**
* Accept list of any options, belonging to intput
*
* @param array $options
*/
public function __construct($options) {
$this->setSettings();
$this->makePropertiesReadable('humanName', 'code', 'value');
parent::__construct($options);
}
/**
* Sets properties by values of descendent constants
*/
protected function setSettings() {
if (!defined('static::HUMAN_NAME') || !defined('static::CODE')
|| !defined('static::VALUE')) {
throw new Exception('Constants are not set up in class ' . get_class($this));
}
$this->humanName = static::HUMAN_NAME;
$this->code = static::CODE;
$this->value = static::VALUE;
}
}