| Conditions | 5 |
| Paths | 5 |
| Total Lines | 24 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 5.246 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 40 | 1 | protected function setDimensions(): Terminal |
|
| 41 | { |
||
| 42 | 1 | $this->dimensions = new Dimensions(); |
|
| 43 | 1 | if (!$this->isWindows()) { |
|
| 44 | 1 | $matcher = [0,0,0]; |
|
| 45 | //$ttyDims = Process::readFromProcess(self::TTY_DIM_COMMAND_0); |
||
| 46 | //echo $ttyDims;die;*/ |
||
| 47 | //var_dump($ttyDims); |
||
| 48 | 1 | $ttyDims = []; |
|
| 49 | 1 | if (!empty($ttyDims)) { |
|
| 50 | $matcher = explode(self::_S, self::_S . $ttyDims); |
||
|
|
|||
| 51 | } else { |
||
| 52 | 1 | $ttyDims = Process::readFromProcess(self::TTY_DIM_COMMAND_1); |
|
| 53 | //var_dump($ttyDims); |
||
| 54 | 1 | if (preg_match('/(\d+)+;.\w{7}.(\d+)+;/', $ttyDims, $matches)) { |
|
| 55 | 1 | $matcher = $matches; |
|
| 56 | } elseif (preg_match('/;(\d+).\w{4};.(\d+)/i', $ttyDims, $matches)) { |
||
| 57 | $matcher = $matches; |
||
| 58 | } |
||
| 59 | } |
||
| 60 | //var_dump($matcher, $ttyDims); |
||
| 61 | 1 | $this->dimensions->set((int) $matcher[2], (int) $matcher[1]); |
|
| 62 | } |
||
| 63 | 1 | return $this; |
|
| 64 | } |
||
| 76 |