| Total Complexity | 13 |
| Total Lines | 69 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | abstract class BaseProvider implements ProviderInterface |
||
| 9 | { |
||
| 10 | protected $configName; |
||
| 11 | protected $config; |
||
| 12 | protected $url; |
||
| 13 | protected $recipientPattern = '/^(00|\+)?(8{2})?0?([0-9]{10})$/i'; |
||
| 14 | |||
| 15 | public function __construct(array $config = [], $url = null) |
||
| 16 | { |
||
| 17 | $this->loadConfigFromFile(); |
||
| 18 | |||
| 19 | if (!empty($config)) { |
||
| 20 | foreach ($config as $key => $value) { |
||
| 21 | $this->config[$key] = $value; |
||
| 22 | } |
||
| 23 | } |
||
| 24 | |||
| 25 | $this->extractUrlFromConfigAndSet($url); |
||
| 26 | } |
||
| 27 | |||
| 28 | public function setConfigName($configName) |
||
| 29 | { |
||
| 30 | $this->configName = $configName; |
||
| 31 | |||
| 32 | return $this->loadConfigFromFile(); |
||
| 33 | } |
||
| 34 | |||
| 35 | public function setConfig(array $config) |
||
| 36 | { |
||
| 37 | $this->config = $config; |
||
| 38 | |||
| 39 | return $this; |
||
| 40 | } |
||
| 41 | |||
| 42 | public function getConfig() |
||
| 43 | { |
||
| 44 | return $this->config; |
||
| 45 | } |
||
| 46 | |||
| 47 | public function setUrl($url) |
||
| 48 | { |
||
| 49 | $this->url = $url; |
||
| 50 | |||
| 51 | return $this; |
||
| 52 | } |
||
| 53 | |||
| 54 | public function getUrl() |
||
| 55 | { |
||
| 56 | return $this->url; |
||
| 57 | } |
||
| 58 | |||
| 59 | private function loadConfigFromFile() |
||
| 67 | } |
||
| 68 | |||
| 69 | private function extractUrlFromConfigAndSet($url = null) |
||
| 70 | { |
||
| 77 | } |
||
| 78 | } |
||
| 79 |