Ignore:
Timestamp:
Nov 24, 2020, 10:58:56 AM (4 years ago)
Author:
chronos
Message:
  • Modified: More static types added.
Location:
trunk/Modules/NetworkConfigRouterOS
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/NetworkConfigRouterOS/Routerboard.php

    r887 r888  
    33class Routerboard
    44{
    5   var $SSHPath = '/usr/bin/ssh';
    6   var $Timeout = 3;
    7   var $HostName;
    8   var $UserName;
    9   var $Password;
    10   var $PrivateKey = '~/.ssh/id_rsa';
    11   var $MaxBurstLineCount = 100;
    12   var $Debug = false;
     5  public string $SSHPath = '/usr/bin/ssh';
     6  public int $Timeout = 3;
     7  public string $HostName;
     8  public string $UserName;
     9  public string $Password;
     10  public string $PrivateKey = '~/.ssh/id_rsa';
     11  public int $MaxBurstLineCount = 100;
     12  public bool $Debug = false;
    1313
    1414  function __construct($HostName = 'localhost', $UserName = 'admin', $Password = '')
     
    1919  }
    2020
    21   function Execute(array $Commands): array
     21  function Execute($Commands): array
    2222  {
    2323    $Output = array();
     
    7575      if (count($ResultLineParts) > 1)
    7676      {
    77         if ($ResultLineParts[1]{0} == '"') $ResultLineParts[1] = substr($ResultLineParts[1], 1, -1); // Remove quotes
     77        if ($ResultLineParts[1][0] == '"') $ResultLineParts[1] = substr($ResultLineParts[1], 1, -1); // Remove quotes
    7878        $List[substr($ResultLineParts[0], 0, -1)] = $ResultLineParts[1];
    7979      } else $List[substr($ResultLineParts[0], 0, -1)] = '';
     
    116116  }
    117117
    118   function ListGetPrint($Path, $Properties, $Conditions = array()): array
     118  function ListGetPrint(array $Path, array $Properties, array $Conditions = array()): array
    119119  {
    120120    $ConditionList = '';
  • trunk/Modules/NetworkConfigRouterOS/Routerboard2.php

    r887 r888  
    55class Routerboard extends SSH
    66{
    7   var $Methods = array(
     7  public array $Methods = array(
    88    'kex' => 'diffie-hellman-group1-sha1',
    99    'client_to_server' => array('crypt' => '3des-cbc', 'comp' => 'none'),
     
    1111  );
    1212
    13   function Execute($Commands): array
     13  function Execute(array $Commands): array
    1414  {
    1515    if (is_array($Commands)) $Commands = implode(';', $Commands);
  • trunk/Modules/NetworkConfigRouterOS/RouterboardAPI.php

    r887 r888  
    33class RouterosAPI
    44{
    5   var $ErrorNo;           // Variable for storing connection error number, if any
    6   var $ErrorStr;          // Variable for storing connection error text, if any
    7   var $Attempts;       // Connection attempt count
    8   var $Connected;  // Connection state
    9   var $Delay;          // Delay between connection attempts in seconds
    10   var $Port;        // Port to connect to
    11   var $Timeout;        // Connection attempt timeout and data read timeout
    12   var $Socket;             // Variable for storing socket resource
    13   var $Debug;
    14   var $SSL; // If SSL API connection is used. You need also change port to 8729
     5  public int $ErrorNo;           // Variable for storing connection error number, if any
     6  public string $ErrorStr;          // Variable for storing connection error text, if any
     7  public int $Attempts;       // Connection attempt count
     8  public bool $Connected;  // Connection state
     9  public int $Delay;          // Delay between connection attempts in seconds
     10  public int $Port;        // Port to connect to
     11  public int $Timeout;        // Connection attempt timeout and data read timeout
     12  public int $Socket;             // Variable for storing socket resource
     13  public bool $Debug;
     14  public bool $SSL; // If SSL API connection is used. You need also change port to 8729
    1515
    1616  function __construct()
  • trunk/Modules/NetworkConfigRouterOS/SSH.php

    r874 r888  
    33class SSH
    44{
    5   var $HostName;
    6   var $UserName;
    7   var $Password;
    8   var $Methods;
     5  public string $HostName;
     6  public string $UserName;
     7  public string $Password;
     8  public array $Methods;
    99
    1010  function __construct($HostName = 'localhost', $UserName = 'admin', $Password = '')
     
    1313    $this->UserName = $UserName;
    1414    $this->Password = $Password;
     15    $this->Methods = array();
    1516  }
    1617
    17   function Execute($Commands)
     18  function Execute(array $Commands): array
    1819  {
    1920    echo($Commands);
Note: See TracChangeset for help on using the changeset viewer.