for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Tylercd100\Rebooter\Drivers\Ssh;
use Ssh\Session;
use Tylercd100\Rebooter\Drivers\ServerController;
use Tylercd100\Rebooter\Exceptions\MethodNotAllowedException;
abstract class Ssh implements ServerController
{
/**
* @var Session
*/
protected $session;
* Gets the SSH session executor
* @return \Ssh\Exec
public function getExec() {
return $this->session->getExec();
}
* Throws an Exception because you cannot boot a powered down machine from ssh
* @return void
public function boot() {
throw new MethodNotAllowedException("You cannot use SSH to boot a powered down server.");
* Executes a Reboot command
public function reboot() {
$exec = $this->getExec();
$exec->run('reboot');
* Executes a Shutdown command
public function shutdown() {
$exec->run('shutdown -P now');
* Gets the value of session.
*
* @return Session
public function getSession()
return $this->session;
* Sets the value of session.
* @param Session $session the session
* @return self
public function setSession(Session $session)
$this->session = $session;
return $this;