| Total Complexity | 3 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | abstract class ProtocolBase |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * The actual logger object |
||
| 14 | * @var LoggerInterface |
||
| 15 | */ |
||
| 16 | protected $logger; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Base constructor for all protocol stuff |
||
| 20 | * @param LoggerInterface|null $logger |
||
| 21 | */ |
||
| 22 | 127 | final public function __construct(LoggerInterface $logger = null) |
|
| 23 | { |
||
| 24 | 127 | if ($logger === null) { |
|
| 25 | 127 | $logger = new Logger(); |
|
| 26 | } |
||
| 27 | |||
| 28 | // Insert name of class within the logger |
||
| 29 | 127 | $this->logger = $logger->withName(str_replace('unreal4u\\MQTT\\', '', \get_class($this))); |
|
|
|
|||
| 30 | |||
| 31 | 127 | $this->initializeObject(); |
|
| 32 | 127 | } |
|
| 33 | |||
| 34 | /** |
||
| 35 | * Should any method have any abnormal default behaviour, we can do so here |
||
| 36 | * |
||
| 37 | * @return ProtocolBase |
||
| 38 | */ |
||
| 39 | 127 | protected function initializeObject(): ProtocolBase |
|
| 42 | } |
||
| 43 | } |
||
| 44 |