Conditions | 1 |
Paths | 1 |
Total Lines | 56 |
Code Lines | 30 |
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 |
||
46 | protected function initCollectors(): void |
||
47 | { |
||
48 | // Inventorio |
||
49 | $this->collectors[] = new InventorioCollector( |
||
50 | $this->isRemoteEnabled(), |
||
51 | $this->areLogfilesEnabled(), |
||
52 | $this->isCollectEnabled(), |
||
53 | $this->config |
||
54 | ); |
||
55 | |||
56 | $this->collectors[] = new CommandCollector($this->config); |
||
57 | // $this->collectors[] = new RandomCollector(); |
||
58 | |||
59 | // General |
||
60 | $this->collectors[] = new OperatingSystemCollector(); |
||
61 | |||
62 | // Hosting |
||
63 | $this->collectors[] = new ASNCollector(); |
||
64 | |||
65 | // Metrics |
||
66 | $this->collectors[] = new MetricThresholdCollector(); |
||
67 | |||
68 | // System / General |
||
69 | $this->collectors[] = new IpCollector(); |
||
70 | $this->collectors[] = new UptimeCollector(); |
||
71 | $this->collectors[] = new PortsCollector(); |
||
72 | $this->collectors[] = new ConfigurationCollector(); |
||
73 | $this->collectors[] = new CronCollector(); |
||
74 | $this->collectors[] = new UserCollector(); |
||
75 | $this->collectors[] = new LogrotateCollector(); |
||
76 | $this->collectors[] = new DiskCollector(); |
||
77 | |||
78 | // System / Services |
||
79 | $this->collectors[] = new SystemDCollector(); |
||
80 | |||
81 | // System / Security |
||
82 | $this->collectors[] = new GeneralSecurityCollector(); |
||
83 | $this->collectors[] = new AuthorizedKeysCollector(); |
||
84 | |||
85 | // Package Managers |
||
86 | $this->collectors[] = new BrewPackageCollector(); |
||
87 | $this->collectors[] = new DpkgPackageCollector(); |
||
88 | |||
89 | // Application / Programming Language |
||
90 | $this->collectors[] = new PhpCollector(); |
||
91 | $this->collectors[] = new WebProsMonitoringCollector(); |
||
92 | |||
93 | // Application / WebServer |
||
94 | $this->collectors[] = new ApacheServerNameCollector(); |
||
95 | $this->collectors[] = new ApacheConfigurationCollector(); |
||
96 | $this->collectors[] = new HeaderCollector(); |
||
97 | |||
98 | // INVENTORY AWARE |
||
99 | $this->collectors[] = new WordPressCollector(); |
||
100 | $this->collectors[] = new DatabaseCredentialCollector(); |
||
101 | $this->collectors[] = new ResponseCollector(); |
||
102 | } |
||
104 |