Changeset 887 for trunk/Modules/NetworkConfig/NetworkConfig.php
- Timestamp:
- Nov 20, 2020, 12:08:12 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/NetworkConfig/NetworkConfig.php
r874 r887 5 5 var $ConfigItems; 6 6 7 function __construct( $System)7 function __construct(System $System) 8 8 { 9 9 parent::__construct($System); … … 17 17 } 18 18 19 function DoInstall() 19 function DoInstall(): void 20 20 { 21 21 } 22 22 23 function DoUnInstall() 23 function DoUnInstall(): void 24 24 { 25 25 } 26 26 27 function DoStart() 27 function DoStart(): void 28 28 { 29 29 $this->System->FormManager->RegisterClass('NetworkConfiguration', array( … … 55 55 'States' => array('Neplánováno', 'V plánu', 'Provádí se'), 56 56 )); 57 58 $this->System->RegisterCommandLine('config', array($this, 'Config'));57 58 $this->System->RegisterCommandLine('config', 'Configures network services.', array($this, 'Config')); 59 59 $this->System->Models['NetworkDevice']->RegisterOnChange('NetworkConfig', array($this, 'DoNetworkChange')); 60 60 $this->System->Models['NetworkInterface']->RegisterOnChange('NetworkConfig', array($this, 'DoNetworkChange')); 61 61 } 62 63 function DoNetworkChange() 62 63 function DoNetworkChange(): void 64 64 { 65 65 $this->Database->query('UPDATE `NetworkConfiguration` SET `Changed`=1 WHERE '. … … 67 67 } 68 68 69 function RegisterConfigItem( $Name, $ClassName)69 function RegisterConfigItem(string $Name, string $ClassName): void 70 70 { 71 71 $this->ConfigItems[$Name] = $ClassName; 72 72 } 73 73 74 function UnregisterConfigItem( $Name)74 function UnregisterConfigItem(string $Name): void 75 75 { 76 76 unset($this->ConfigItems[$Name]); 77 77 } 78 78 79 function Config( $Parameters)79 function Config(array $Parameters): void 80 80 { 81 81 $Output = ''; … … 90 90 } else $Output = 'Config item '.$ConfigItemName.' not found'; 91 91 } else $Output = 'Not enough parameters'; 92 return $Output; 92 echo($Output); 93 } 94 95 static function Cast(AppModule $AppModule): ModuleNetworkConfig 96 { 97 if ($AppModule instanceof ModuleNetworkConfig) 98 { 99 return $AppModule; 100 } 101 throw new Exception('Expected ModuleNetworkConfig type but got '.gettype($AppModule)); 93 102 } 94 103 } … … 96 105 class NetworkConfigItem extends Model 97 106 { 98 function Run() 107 function Run(): void 99 108 { 100 101 109 } 102 110 }
Note:
See TracChangeset
for help on using the changeset viewer.