| Total Complexity | 3 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 4 | trait ConfigTrait |
||
| 5 | { |
||
| 6 | |||
| 7 | /** |
||
| 8 | * 配置信息 |
||
| 9 | * |
||
| 10 | * @var array |
||
| 11 | */ |
||
| 12 | protected $config; |
||
| 13 | |||
| 14 | public function applyConfig(array $config) |
||
| 15 | { |
||
| 16 | $defaultConfig = $this->getDefaultConfig(); |
||
| 17 | foreach ($defaultConfig as $name => $value) { |
||
| 18 | $this->config[$name] = $config[$name] ?? $this->config[$name] ?? $value; |
||
| 19 | } |
||
| 20 | } |
||
| 21 | public function getConfig(string $name, $default =null) { |
||
| 24 | } |
||
| 25 | |||
| 26 | abstract public function getDefaultConfig():array; |
||
| 27 | } |
||
| 28 |