enablePTY(); $ssh->exec("which $this->package"); if ($this->state === State::PRESENT) { $state = ! empty($ssh->read()); } else if ($this->state === State::ABSENT) { $state = empty($ssh->read()); } $ssh->disablePTY(); return $state; } public function getCommands(): array { if ($this->state === State::PRESENT) { return [ "sudo apt install -y $this->package", ]; } else if ($this->state === State::ABSENT) { return [ "sudo apt remove -y $this->package", ]; } return []; } }