| Total Complexity | 8 |
| Total Lines | 66 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php declare( strict_types=1 ); |
||
| 11 | abstract class ContextSource implements LoggerAwareInterface { |
||
| 12 | /** @var LoggerInterface */ |
||
| 13 | private $logger; |
||
| 14 | |||
| 15 | /** @var Config */ |
||
| 16 | private $config; |
||
| 17 | |||
| 18 | /** @var WikiController */ |
||
| 19 | private $controller; |
||
| 20 | |||
| 21 | public function __construct() { |
||
| 22 | $this->setLogger( new Logger ); |
||
| 23 | $this->setConfig( Config::getInstance() ); |
||
| 24 | $this->setController( new WikiController ); |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @return LoggerInterface |
||
| 29 | */ |
||
| 30 | protected function getLogger() : LoggerInterface { |
||
| 31 | return $this->logger; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @inheritDoc |
||
| 36 | */ |
||
| 37 | public function setLogger( LoggerInterface $logger ) { |
||
| 38 | $this->logger = $logger; |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @return Config |
||
| 43 | */ |
||
| 44 | protected function getConfig() : Config { |
||
| 45 | return $this->config; |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @param Config $cfg |
||
| 50 | */ |
||
| 51 | protected function setConfig( Config $cfg ) { |
||
| 52 | $this->config = $cfg; |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @return WikiController |
||
| 57 | */ |
||
| 58 | protected function getController() : WikiController { |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * @param WikiController $controller |
||
| 64 | */ |
||
| 65 | protected function setController( WikiController $controller ) { |
||
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * Get a message |
||
| 71 | * |
||
| 72 | * @param string $key |
||
| 73 | * @return Message |
||
| 74 | */ |
||
| 75 | protected function msg( string $key ) : Message { |
||
| 79 |