gluon-web-remote

Web remote Administration for big size of gluon routers
git clone git://archive.git.mtrnord.blog/MTRNord/gluon-web-remote.git
Log | Files | Refs | README

Configuration.php (2609B)


      1 <?php
      2 
      3 namespace Ssh;
      4 
      5 /**
      6  * Configuration of an SSH connection
      7  *
      8  * @author Antoine Hérault <antoine.herault@gmail.com>
      9  */
     10 class Configuration
     11 {
     12     protected $host;
     13     protected $port;
     14     protected $methods;
     15     protected $callbacks;
     16     protected $identity;
     17 
     18     /**
     19      * Constructor
     20      *
     21      * @param  string  $host
     22      * @param  integer $port
     23      * @param  array   $methods
     24      * @param  array   $callbacks
     25      * @param  string  $identity
     26      */
     27     public function __construct($host, $port = 22, array $methods = array(), array $callbacks = array(), $identity = null)
     28     {
     29         $this->host      = $host;
     30         $this->port      = $port;
     31         $this->methods   = $methods;
     32         $this->callbacks = $callbacks;
     33         $this->identity  = $identity;
     34     }
     35 
     36     /**
     37      * Defines the host
     38      *
     39      * @param  string $host
     40      */
     41     public function setHost($host)
     42     {
     43         $this->host = $host;
     44     }
     45 
     46     /**
     47      * Returns the host
     48      *
     49      * @return string
     50      */
     51     public function getHost()
     52     {
     53         return $this->host;
     54     }
     55 
     56     /**
     57      * Defines the port
     58      *
     59      * @param  integer $port
     60      */
     61     public function setPort($port)
     62     {
     63         $this->port = $port;
     64     }
     65 
     66     /**
     67      * Returns the port
     68      *
     69      * @return integer
     70      */
     71     public function getPort()
     72     {
     73         return $this->port;
     74     }
     75 
     76     /**
     77      * Defines the methods
     78      *
     79      * @param  array $methods
     80      */
     81     public function setMethods(array $methods)
     82     {
     83         $this->methods = $methods;
     84     }
     85 
     86     /**
     87      * Returns the methods
     88      *
     89      * @return array
     90      */
     91     public function getMethods()
     92     {
     93         return $this->methods;
     94     }
     95 
     96     /**
     97      * Defines the callbacks
     98      *
     99      * @param array $callbacks
    100      */
    101     public function setCallbacks(array $callbacks)
    102     {
    103         $this->callbacks = $callbacks;
    104     }
    105 
    106     /**
    107      * Returns the callbacks
    108      *
    109      * @return array $callbacks
    110      */
    111     public function getCallbacks()
    112     {
    113         return $this->callbacks;
    114     }
    115 
    116     /**
    117      * Returns an array of argument designed for the ssh2_connect function
    118      *
    119      * @return array
    120      */
    121     public function asArguments()
    122     {
    123         return array(
    124             $this->host,
    125             $this->port,
    126             $this->methods,
    127             $this->callbacks
    128         );
    129     }
    130 
    131     /**
    132      * @return string
    133      */
    134     public function getIdentity()
    135     {
    136         return $this->identity;
    137     }
    138 
    139     /**
    140      * @param string $identity
    141      */
    142     public function setIdentity($identity)
    143     {
    144         $this->identity = $identity;
    145     }
    146 }