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