| Total Complexity | 5 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Coverage | 81.25% |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | final class Printer |
||
| 21 | { |
||
| 22 | /** @var Connector */ |
||
| 23 | private $connector; |
||
| 24 | |||
| 25 | /** @var Compiler|null */ |
||
| 26 | private $compiler; |
||
| 27 | |||
| 28 | 3 | public function __construct(Connector $connector, ?Compiler $compiler = null) |
|
| 32 | 3 | } |
|
| 33 | |||
| 34 | 2 | public function print(Job $job): void |
|
| 35 | { |
||
| 36 | 2 | if ($this->compiler === null) { |
|
| 37 | 1 | throw new \DomainException( |
|
| 38 | 1 | 'The Printer object should be constructed with Compiler instance for printing.' |
|
| 39 | ); |
||
| 40 | } |
||
| 41 | |||
| 42 | 1 | $this->connector->write($this->compiler->compile($job)); |
|
| 43 | 1 | } |
|
| 44 | |||
| 45 | 1 | public function send($payload): void |
|
| 46 | { |
||
| 47 | 1 | $this->connector->write($payload); |
|
| 48 | 1 | } |
|
| 49 | |||
| 50 | public function ask(string $message) |
||
| 55 | } |
||
| 56 | } |
||
| 57 |