1 | <?php |
||
2 | /** |
||
3 | * Copyright © Getnet. All rights reserved. |
||
4 | * |
||
5 | * @author Bruno Elisei <[email protected]> |
||
6 | * See LICENSE for license details. |
||
7 | */ |
||
8 | |||
9 | namespace Getnet\PaymentMagento\Model\Console\Command; |
||
10 | |||
11 | use Magento\Payment\Model\Method\Logger; |
||
12 | use Symfony\Component\Console\Output\OutputInterface; |
||
13 | |||
14 | class AbstractModel |
||
15 | { |
||
16 | /** |
||
17 | * @var Logger |
||
18 | */ |
||
19 | protected $logger; |
||
20 | |||
21 | /** |
||
22 | * @var OutputInterface |
||
23 | */ |
||
24 | protected $output; |
||
25 | |||
26 | /** |
||
27 | * @param Logger $logger |
||
28 | */ |
||
29 | public function __construct( |
||
30 | Logger $logger |
||
31 | ) { |
||
32 | $this->logger = $logger; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Output. |
||
37 | * |
||
38 | * @param OutputInterface $output |
||
39 | * |
||
40 | * @return void |
||
41 | */ |
||
42 | public function setOutput(OutputInterface $output) |
||
43 | { |
||
44 | $this->output = $output; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Console Write. |
||
49 | * |
||
50 | * @param string $text |
||
51 | * |
||
52 | * @return void |
||
53 | */ |
||
54 | protected function write(string $text) |
||
55 | { |
||
56 | if ($this->output instanceof OutputInterface) { |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
57 | $this->output->write($text); |
||
58 | } |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * Console WriteLn. |
||
63 | * |
||
64 | * @param string $text |
||
65 | * |
||
66 | * @return void |
||
67 | */ |
||
68 | protected function writeln($text) |
||
69 | { |
||
70 | if ($this->output instanceof OutputInterface) { |
||
0 ignored issues
–
show
|
|||
71 | $this->output->writeln($text); |
||
72 | } |
||
73 | } |
||
74 | } |
||
75 |