Example #1
0
 /**
  * Typically called from Connection::execute()
  *
  * @param string     $command
  * @param Connection $connection
  * @param Terminal   $terminal
  * @param string     $pty
  */
 function __construct($command, Connection $connection, Terminal $terminal, $pty = null)
 {
     $this->command = $command;
     $this->connection = $connection;
     $this->terminal = $terminal;
     if (!$connection->isConnected()) {
         throw new NotConnectedException();
     }
     if (!$connection->isAuthenticated()) {
         throw new NotAuthenticatedException();
     }
     $this->resource = ssh2_exec($connection->getResource(), $command, $pty, $terminal->getEnv(), $terminal->getWidth(), $terminal->getHeight(), $terminal->getDimensionUnitType());
 }
Example #2
0
File: Shell.php Project: bravo3/ssh
 /**
  * Typically called from Connection::getShell()
  *
  * @param Connection $connection
  * @param Terminal   $terminal
  */
 function __construct(Connection $connection, Terminal $terminal)
 {
     if (!$connection->isConnected()) {
         throw new NotConnectedException();
     }
     if (!$connection->isAuthenticated()) {
         throw new NotAuthenticatedException();
     }
     $this->shell_type = null;
     $this->connection = $connection;
     $this->terminal = $terminal;
     $this->resource = ssh2_shell($connection->getResource(), $terminal->getTerminalType(), $terminal->getEnv(), $terminal->getWidth(), $terminal->getHeight(), $terminal->getDimensionUnitType());
 }
Example #3
0
 /**
  * @small
  */
 public function testProperties()
 {
     $terminal = new Terminal();
     $this->assertEquals(TerminalType::XTERM, $terminal->getTerminalType());
     $this->assertEquals(TerminalUnit::CHARACTERS, $terminal->getDimensionUnitType());
 }