Ignore:
Timestamp:
Nov 20, 2020, 12:08:12 AM (4 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/Generators/Queue.php

    r873 r887  
    1414  }
    1515
    16   function Print()
     16  function Print(): string
    1717  {
    1818    $Output = '(Min: '.$this->Min.' Max: '.$this->Max;
     
    4646  }
    4747
    48   function CheckName($Name, &$UsedNames)
     48  function CheckName($Name, &$UsedNames): void
    4949  {
    5050    if (in_array($Name, $UsedNames)) die("\n".'Duplicate name: '.$Name);
     
    5252  }
    5353
    54   function GetCommands(&$UsedNames = null)
     54  function GetCommands(&$UsedNames = null): array
    5555  {
    5656    if ($UsedNames == null) $UsedNames = array();
     
    7272  }
    7373
    74   function GetParentName(string $Suffix)
     74  function GetParentName(string $Suffix): string
    7575  {
    7676    if ($this->Parent != null) return $this->Parent->Name.$Suffix;
     
    7878  }
    7979
    80   function UpdateMinSpeeds()
     80  function UpdateMinSpeeds(): void
    8181  {
    8282    if (($this->LimitIn->Min == 0) or ($this->LimitOut->Min == 0))
     
    100100class SpeedLimitItems extends GenericList
    101101{
    102   function AddNew(string $Name, SpeedLimitItem $Parent = null)
     102  function AddNew(string $Name, SpeedLimitItem $Parent = null): SpeedLimitItem
    103103  {
    104104    $Item = new SpeedLimitItem($Name, $Parent);
    105     $Item->LimitIn = new SpeedLimit();
    106     $Item->LimitOut = new SpeedLimit();
     105    $Item->LimitIn = new SpeedLimit(0, 0);
     106    $Item->LimitOut = new SpeedLimit(0, 0);
    107107    $this->Items[] = $Item;
    108108    return $Item;
     
    119119  }
    120120
    121   function GetCommands(&$UsedNames)
     121  function GetCommands(&$UsedNames): array
    122122  {
    123123    $Output = array();
     
    137137  var $SpeedLimits;
    138138
    139   function Run()
     139  function Run(): void
    140140  {
    141141    $PathQueue = array('queue', 'tree');
     
    149149    $this->UsedNames = array();
    150150
    151     $Finance = &$this->System->Modules['Finance'];
     151    $Finance = &ModuleFinance::Cast($this->System->GetModule('Finance'))->Finance;
    152152    $Finance->LoadMonthParameters(0);
    153153
     
    280280  }
    281281
    282   function BuildSpeedLimit(&$SpeedLimit, $TopSpeedLimitItem)
     282  function BuildSpeedLimit(&$SpeedLimit, $TopSpeedLimitItem): void
    283283  {
    284284    $SpeedLimitName = $SpeedLimit['Name'].'-grp';
     
    297297  }
    298298
    299   function LoadSpeedLimits($SpeedLimitItem)
     299  function LoadSpeedLimits($SpeedLimitItem): void
    300300  {
    301301    echo('Limit groups: ');
     
    326326  }
    327327
    328   function UpdateMinSpeed($DeviceId)
     328  function UpdateMinSpeed($DeviceId): void
    329329  {
    330330    $MinSpeed = 0;
     
    340340
    341341  // Calculate maximum real speed available for each network device Start with main router and continue with adjecement nodes.
    342   function BuildTree($RootDeviceId, $BaseSpeed)
     342  function BuildTree($RootDeviceId, $BaseSpeed): void
    343343  {
    344344    // Load network devices
     
    438438  }
    439439
    440   function BuildQueueItems($DeviceId, $SpeedLimitParent)
     440  function BuildQueueItems($DeviceId, $SpeedLimitParent): void
    441441  {
    442442    $Device = $this->Devices[$DeviceId];
     
    475475  }
    476476
    477   function RunTopology()
     477  function RunTopology(): void
    478478  {
    479479    $PathQueue = array('queue', 'tree');
     
    487487    $this->UsedNames = array();
    488488
    489     $Finance = &$this->System->Modules['Finance'];
     489    $Finance = &ModuleFinance::Cast($this->System->GetModule('Finance'))->Finance;
    490490    $Finance->LoadMonthParameters(0);
    491491
Note: See TracChangeset for help on using the changeset viewer.