| Total Complexity | 10 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | class LoggingConfigurator |
||
| 17 | { |
||
| 18 | public $applicationRoot = null; |
||
| 19 | public $configDir = null; |
||
| 20 | public $configs = null; |
||
| 21 | private $container = null; |
||
| 22 | |||
| 23 | 3 | public function __construct($container) |
|
| 24 | { |
||
| 25 | 3 | $this->container = $container; |
|
| 26 | 3 | } |
|
| 27 | |||
| 28 | 3 | public function setAppRoot($directory) { |
|
| 29 | 3 | $this->applicationRoot = $directory; |
|
| 30 | 3 | } |
|
| 31 | |||
| 32 | 3 | public function setConfigDir($configDirectory) { |
|
| 33 | 3 | $this->configDir = $this->applicationRoot . "/" . $configDirectory; |
|
| 34 | |||
| 35 | 3 | if(file_exists($this->configDir) === false ) mkdir($this->configDir); |
|
| 36 | |||
| 37 | 3 | return (file_exists($this->configDir) && is_writable($this->configDir)); |
|
| 38 | } |
||
| 39 | |||
| 40 | 2 | public function loadLoggingConf() { |
|
| 43 | } |
||
| 44 | |||
| 45 | 2 | public function getServiceLogConfig($logName) { |
|
| 46 | |||
| 47 | 2 | foreach($this->configs->services as $logObject) { |
|
| 48 | |||
| 49 | 2 | $config = $this->container->get(LoggingConfig::class); |
|
| 50 | 2 | $config->importJSON($logObject); |
|
| 51 | |||
| 52 | 2 | if($logObject->name === $logName) return $config; |
|
| 53 | } |
||
| 54 | |||
| 55 | 1 | return false; |
|
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @param LoggingConfig $config |
||
| 60 | * @throws \Exception |
||
| 61 | */ |
||
| 62 | |||
| 63 | 1 | public function getLogger(LoggingConfig $config) { |
|
| 68 | } |
||
| 69 | } |