1 | <?php |
||
10 | class Event |
||
11 | { |
||
12 | private $_command; |
||
13 | private $_output = []; |
||
14 | private $_result; |
||
15 | const TOKEN = 'b2b pushed'; |
||
16 | |||
17 | /** |
||
18 | * __construct |
||
19 | * |
||
20 | * @param string $command |
||
21 | * @param string $password |
||
22 | * @access public |
||
23 | */ |
||
24 | public function __construct($command, $password) |
||
36 | |||
37 | /** |
||
38 | * getResult |
||
39 | * |
||
40 | * @access public |
||
41 | * @return void |
||
42 | */ |
||
43 | public function getResult() |
||
51 | |||
52 | /** |
||
53 | * logResult |
||
54 | * |
||
55 | * @param string $file |
||
56 | * @access public |
||
57 | * @return void |
||
58 | */ |
||
59 | public function logResult($file) |
||
66 | |||
67 | /** |
||
68 | * logRequest |
||
69 | * |
||
70 | * @param string $file |
||
71 | * @access public |
||
72 | * @return void |
||
73 | */ |
||
74 | public function logRequest($file) |
||
95 | |||
96 | /** |
||
97 | * writeToFile |
||
98 | * |
||
99 | * Write to file |
||
100 | * |
||
101 | * @param string $file relative path to file for write the content |
||
102 | * Example: `bashexec.log` |
||
103 | * |
||
104 | * @param mixed $content String or array |
||
105 | * @access public |
||
106 | * @return void |
||
107 | */ |
||
108 | public function writeToFile($file, $content) |
||
117 | } |
||
118 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: