| Conditions | 1 |
| Paths | 1 |
| Total Lines | 119 |
| Code Lines | 67 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 30 | public static function getDependencyTable(): array |
||
| 31 | { |
||
| 32 | $tables = []; |
||
| 33 | |||
| 34 | $tables[] = [ |
||
| 35 | 'filePath' => '*', |
||
| 36 | 'functions' => [ |
||
| 37 | WorkerModelsEvents::R_PBX_CORE_RELOAD, |
||
| 38 | WorkerModelsEvents::R_ADVICE, |
||
| 39 | ], |
||
| 40 | ]; |
||
| 41 | |||
| 42 | $tables[] = [ |
||
| 43 | 'filePath' => '/etc/asterisk/manager.conf', |
||
| 44 | 'functions' => [ |
||
| 45 | WorkerModelsEvents::R_MANAGERS |
||
| 46 | ], |
||
| 47 | ]; |
||
| 48 | |||
| 49 | $tables[] = [ |
||
| 50 | 'filePath' => '/etc/asterisk/musiconhold.conf', |
||
| 51 | 'functions' => [ |
||
| 52 | WorkerModelsEvents::R_MOH |
||
| 53 | ], |
||
| 54 | ]; |
||
| 55 | |||
| 56 | $tables[] = [ |
||
| 57 | 'filePath' => '/etc/asterisk/modules.conf', |
||
| 58 | 'functions' => [ |
||
| 59 | WorkerModelsEvents::R_MODULES_CONF |
||
| 60 | ], |
||
| 61 | ]; |
||
| 62 | |||
| 63 | $tables[] = [ |
||
| 64 | 'filePath' => '/etc/asterisk/hep.conf', |
||
| 65 | 'functions' => [ |
||
| 66 | WorkerModelsEvents::R_HEP |
||
| 67 | ], |
||
| 68 | ]; |
||
| 69 | |||
| 70 | $tables[] = [ |
||
| 71 | 'filePath' => '/etc/asterisk/http.conf', |
||
| 72 | 'functions' => [ |
||
| 73 | WorkerModelsEvents::R_MANAGERS |
||
| 74 | ], |
||
| 75 | ]; |
||
| 76 | |||
| 77 | $tables[] = [ |
||
| 78 | 'filePath' => '/var/spool/cron/crontabs/root', |
||
| 79 | 'functions' => [ |
||
| 80 | WorkerModelsEvents::R_CRON |
||
| 81 | ], |
||
| 82 | ]; |
||
| 83 | |||
| 84 | $tables[] = [ |
||
| 85 | 'filePath' => '/etc/asterisk/queues.conf', |
||
| 86 | 'functions' => [ |
||
| 87 | WorkerModelsEvents::R_QUEUES |
||
| 88 | ], |
||
| 89 | ]; |
||
| 90 | |||
| 91 | $tables[] = [ |
||
| 92 | 'filePath' => '/etc/asterisk/features.conf', |
||
| 93 | 'functions' => [ |
||
| 94 | WorkerModelsEvents::R_FEATURES |
||
| 95 | ], |
||
| 96 | ]; |
||
| 97 | |||
| 98 | $tables[] = [ |
||
| 99 | 'filePath' => '/etc/ntp.conf', |
||
| 100 | 'functions' => [ |
||
| 101 | WorkerModelsEvents::R_NTP |
||
| 102 | ], |
||
| 103 | ]; |
||
| 104 | |||
| 105 | $tables[] = [ |
||
| 106 | 'filePath' => '/etc/asterisk/ooh323.conf', |
||
| 107 | 'functions' => [ |
||
| 108 | WorkerModelsEvents::R_H323 |
||
| 109 | ], |
||
| 110 | ]; |
||
| 111 | |||
| 112 | $tables[] = [ |
||
| 113 | 'filePath' => '/etc/asterisk/rtp.conf', |
||
| 114 | 'functions' => [ |
||
| 115 | WorkerModelsEvents::R_RTP |
||
| 116 | ], |
||
| 117 | ]; |
||
| 118 | |||
| 119 | // Restart network if the file /etc/static-routes was changed |
||
| 120 | $tables[] = [ |
||
| 121 | 'filePath' => '/etc/static-routes', |
||
| 122 | 'functions' => [ |
||
| 123 | WorkerModelsEvents::R_NETWORK |
||
| 124 | ], |
||
| 125 | ]; |
||
| 126 | |||
| 127 | $tables[] = [ |
||
| 128 | 'filePath' => '/etc/openvpn.ovpn', |
||
| 129 | 'functions' => [ |
||
| 130 | WorkerModelsEvents::R_NETWORK |
||
| 131 | ], |
||
| 132 | ]; |
||
| 133 | |||
| 134 | $tables[] = [ |
||
| 135 | 'filePath' => '/etc/firewall_additional', |
||
| 136 | 'functions' => [ |
||
| 137 | WorkerModelsEvents::R_FIREWALL |
||
| 138 | ], |
||
| 139 | ]; |
||
| 140 | |||
| 141 | $tables[] = [ |
||
| 142 | 'filePath' => '/etc/fail2ban/jail.local', |
||
| 143 | 'functions' => [ |
||
| 144 | WorkerModelsEvents::R_FIREWALL |
||
| 145 | ], |
||
| 146 | ]; |
||
| 147 | |||
| 148 | return $tables; |
||
| 149 | } |
||
| 150 | } |