| Total Complexity | 8 |
| Total Lines | 117 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class Terminal |
||
| 12 | { |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Interactive connection (pseudo-tty) |
||
| 16 | * |
||
| 17 | * @var string |
||
| 18 | */ |
||
| 19 | private $pty = NULL; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Environmental variables (associative array). |
||
| 23 | * |
||
| 24 | * @var array |
||
| 25 | */ |
||
| 26 | private $env = []; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Width of the virtual terminal. |
||
| 30 | * |
||
| 31 | * @var int |
||
| 32 | */ |
||
| 33 | private $width = 80; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Height of the virtual terminal. |
||
| 37 | * |
||
| 38 | * @var int |
||
| 39 | */ |
||
| 40 | private $height = 25; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Sets interactive connection (pseudo-tty). |
||
| 44 | * |
||
| 45 | * @param string $pty pseudo-tty |
||
| 46 | * @return object |
||
| 47 | */ |
||
| 48 | final public function set_pty($pty) |
||
| 49 | { |
||
| 50 | $this->pty = $pty; |
||
| 51 | return $this; |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Sets environmental variables. |
||
| 56 | * |
||
| 57 | * @param array $env environmental variables |
||
| 58 | * @return object |
||
| 59 | */ |
||
| 60 | final public function set_env($env) |
||
| 61 | { |
||
| 62 | $this->env = $env; |
||
| 63 | return $this; |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * Sets width of virtual terminal. |
||
| 68 | * |
||
| 69 | * @param int $width width of virtual terminal |
||
| 70 | * @return object |
||
| 71 | */ |
||
| 72 | final public function set_width($width) |
||
| 73 | { |
||
| 74 | $this->width = $width; |
||
| 75 | return $this; |
||
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * Sets height of virtual terminal. |
||
| 80 | * |
||
| 81 | * @param int $height height of virtual terminal |
||
| 82 | * @return object |
||
| 83 | */ |
||
| 84 | final public function set_height($height) |
||
| 85 | { |
||
| 86 | $this->height = $height; |
||
| 87 | return $this; |
||
| 88 | } |
||
| 89 | |||
| 90 | /** |
||
| 91 | * Gets interactive connection (pseudo-tty). |
||
| 92 | * |
||
| 93 | * @return string |
||
| 94 | */ |
||
| 95 | final public function get_pty() |
||
| 98 | } |
||
| 99 | |||
| 100 | /** |
||
| 101 | * Gets environmental variables. |
||
| 102 | * |
||
| 103 | * @return array |
||
| 104 | */ |
||
| 105 | final public function get_env() |
||
| 106 | { |
||
| 107 | return $this->env; |
||
| 108 | } |
||
| 109 | |||
| 110 | /** |
||
| 111 | * Gets width of virtual terminal. |
||
| 112 | * |
||
| 113 | * @return int |
||
| 114 | */ |
||
| 115 | final public function get_width() |
||
| 116 | { |
||
| 117 | return $this->width; |
||
| 118 | } |
||
| 119 | |||
| 120 | /** |
||
| 121 | * Gets height of virtual terminal. |
||
| 122 | * |
||
| 123 | * @return int |
||
| 124 | */ |
||
| 125 | final public function get_height() |
||
| 128 | } |
||
| 129 | } |
||
| 130 |