Ignore:
Timestamp:
Nov 20, 2020, 12:08:12 AM (3 years ago)
Author:
chronos
Message:
  • Added: Static types added to almost all classes, methods and function. Supported by PHP 7.4.
  • Fixed: Various found code issues.
File:
1 edited

Legend:

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

    r874 r887  
    1111  );
    1212
    13   function Execute($Commands)
     13  function Execute($Commands): array
    1414  {
    1515    if (is_array($Commands)) $Commands = implode(';', $Commands);
     
    1717  }
    1818
    19   function GetItem($Command)
     19  function GetItem($Command): array
    2020  {
    2121    $Result = $this->Execute($Command);
     
    2525    {
    2626      $ResultLineParts = explode(' ', trim($ResultLine));
    27       if ($ResultLineParts[1]{0} == '"') $ResultLineParts[1] = substr($ResultLineParts[1], 1, -1); // Remove quotes
     27      if ($ResultLineParts[1][0] == '"') $ResultLineParts[1] = substr($ResultLineParts[1], 1, -1); // Remove quotes
    2828      $List[substr($ResultLineParts[0], 0, -1)] = $ResultLineParts[1];
    2929    }
     
    3131  }
    3232
    33   function GetList($Command, $Properties)
     33  function GetList($Command, $Properties): array
    3434  {
    3535    $PropertyList = '"';
     
    5555  }
    5656
    57   function GetSystemResource()
     57  function GetSystemResource(): array
    5858  {
    5959    return $this->GetItem('/system resource print');
    6060  }
    6161
    62   function GetFirewallFilterList()
     62  function GetFirewallFilterList(): array
    6363  {
    6464    return $this->GetList('/ip firewall nat', array('src-address', 'dst-address', 'bytes'));
    6565  }
    6666
    67   function GetDHCPServerLeasesList()
     67  function GetDHCPServerLeasesList(): array
    6868  {
    6969    return $this->GetList('/ip dhcp-server lease', array('address', 'active-address', 'comment', 'lease-time', 'status', 'host-name'));
Note: See TracChangeset for help on using the changeset viewer.