Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
settingsbase.php
1<?php
2
4
5
12
13abstract class SettingsBase
14 implements ISettings
15{
16 protected static $currentSettings = null;
17 protected $settings = array();
18
23 protected function __construct(array $settings = null)
24 {
25 if($settings !== null)
26 {
27 $this->settings = $settings;
28 }
29 }
30
37 protected function resolveName($entityTypeId)
38 {
39 if(!is_int($entityTypeId))
40 {
41 throw new ArgumentTypeException('entityTypeID', 'integer');
42 }
43
44 if(!EntityType::IsDefined($entityTypeId))
45 {
46 throw new NotSupportedException("Entity ID: '{$entityTypeId}' is not supported in current context");
47 }
48
49 return EntityType::ResolveName($entityTypeId);
50 }
51
56 static protected function loadCurrentSettings()
57 {
58 throw new NotImplementedException('The method is not implemented.');
59 }
60
67 protected function getValueFor($entityTypeId, $name, $default='')
68 {
69 $entityTypeName = $this->resolveName($entityTypeId);
70 return (isset($this->settings[$name][$entityTypeName]) ? $this->settings[$name][$entityTypeName]: $default);
71 }
72
79 public function prefixFor($entityTypeId)
80 {
81 return $this->getValueFor($entityTypeId, 'accountNumberPrefix');
82 }
83}
getValueFor($entityTypeId, $name, $default='')