| Conditions | 1 |
| Paths | 1 |
| Total Lines | 127 |
| Code Lines | 116 |
| 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 declare(strict_types=1); |
||
| 101 | protected static function printHelp(): void |
||
| 102 | { |
||
| 103 | self::printBanner(); |
||
| 104 | |||
| 105 | Console::log(' ' . Console::text('SYNOPSIS:', 'white', 'underline')); |
||
| 106 | Console::log(' ' . Console::text(' abuseipdb -C ') . |
||
| 107 | Console::text('IP', 'yellow') . |
||
| 108 | Console::text(' [-d ') . |
||
| 109 | Console::text('DAYS', 'yellow') . |
||
| 110 | Console::text('] [-v] [-l ') . |
||
| 111 | Console::text('LIMIT', 'yellow') . |
||
| 112 | Console::text('] [-o ') . |
||
| 113 | Console::text('FORMAT', 'yellow') . |
||
| 114 | Console::text(']')); |
||
| 115 | |||
| 116 | Console::log(' ' . Console::text(' abuseipdb -K ') . |
||
| 117 | Console::text('NETWORK', 'yellow') . |
||
| 118 | Console::text(' [-d ') . |
||
| 119 | Console::text('DAYS', 'yellow') . |
||
| 120 | Console::text('] [-o ') . |
||
| 121 | Console::text('FORMAT', 'yellow') . |
||
| 122 | Console::text(']')); |
||
| 123 | |||
| 124 | Console::log(' ' . Console::text(' abuseipdb -R ') . |
||
| 125 | Console::text('IP', 'yellow') . ' -c ' . |
||
| 126 | Console::text('CATEGORIES', 'yellow') . ' -m ' . |
||
| 127 | Console::text('MESSAGE', 'yellow') . |
||
| 128 | Console::text(' [-o ') . |
||
| 129 | Console::text('FORMAT', 'yellow') . |
||
| 130 | Console::text(']')); |
||
| 131 | |||
| 132 | Console::log(' ' . Console::text(' abuseipdb -V ') . |
||
| 133 | Console::text('FILE', 'yellow') . |
||
| 134 | Console::text(' [-o ') . |
||
| 135 | Console::text('FORMAT', 'yellow') . |
||
| 136 | Console::text(']')); |
||
| 137 | |||
| 138 | Console::log(' ' . Console::text(' abuseipdb -E ') . |
||
| 139 | Console::text('IP', 'yellow'). |
||
| 140 | Console::text(' [-o ') . |
||
| 141 | Console::text('FORMAT', 'yellow') . |
||
| 142 | Console::text(']')); |
||
| 143 | |||
| 144 | Console::log(' ' . Console::text(' abuseipdb -B ') . |
||
| 145 | Console::text('[-l ') . |
||
| 146 | Console::text('LIMIT', 'yellow') . |
||
| 147 | Console::text('] [-s ') . |
||
| 148 | Console::text('SCORE', 'yellow') . |
||
| 149 | Console::text('] [-o ') . |
||
| 150 | Console::text('FORMAT', 'yellow') . |
||
| 151 | Console::text(']')); |
||
| 152 | |||
| 153 | Console::log(' ' . Console::text(' abuseipdb -S ' . |
||
| 154 | Console::text('KEY', 'yellow'))); |
||
| 155 | |||
| 156 | Console::log(' ' . Console::text(' abuseipdb -L | -G | -h | --version')); |
||
| 157 | |||
| 158 | Console::log(); |
||
| 159 | Console::log(' ' . Console::text('OPTIONS:', 'white', 'underline')); |
||
| 160 | Console::log(); |
||
| 161 | Console::log(Console::text(' -h, --help', 'white')); |
||
| 162 | Console::log(' Prints the current help. If given, all next arguments are ignored.', 'lightgray'); |
||
| 163 | Console::log(); |
||
| 164 | Console::log(Console::text(' -G, --config', 'white')); |
||
| 165 | Console::log(' Prints the current config. If given, all next arguments are ignored.', 'lightgray'); |
||
| 166 | Console::log(); |
||
| 167 | Console::log(Console::text(' -L, --list', 'white')); |
||
| 168 | Console::log(' Prints the list report categories. If given, all next arguments are ignored.', 'lightgray'); |
||
| 169 | Console::log(); |
||
| 170 | Console::log(Console::text(' -C, --check ', 'white') . Console::text('IP', 'yellow', 'underline')); |
||
| 171 | Console::log(' Performs a check request for the given IP address. A valid IPv4 or IPv6 address is required.', 'lightgray'); |
||
| 172 | Console::log(); |
||
| 173 | Console::log(Console::text(' -K, --check-block ', 'white') . Console::text('network', 'yellow', 'underline')); |
||
| 174 | Console::log(' Performs a check-block request for the given network. A valid subnet (v4 or v6) denoted with ', 'lightgray'); |
||
| 175 | Console::log(' CIDR notation is required.', 'lightgray'); |
||
| 176 | Console::log(); |
||
| 177 | Console::log(Console::text(' -d, --days ', 'white') . Console::text('DAYS', 'yellow', 'underline')); |
||
| 178 | Console::log(' For a check or check-block request, defines the maxAgeDays. Min is 1, max is 365, default is 30.', 'lightgray'); |
||
| 179 | Console::log(); |
||
| 180 | Console::log(Console::text(' -R, --report ', 'white') . Console::text('IP', 'yellow', 'underline')); |
||
| 181 | Console::log(' Performs a report request for the given IP address. A valid IPv4 or IPv6 address is required.', 'lightgray'); |
||
| 182 | Console::log(); |
||
| 183 | Console::log(Console::text(' -V, --bulk-report ', 'white') . Console::text('FILE', 'yellow', 'underline')); |
||
| 184 | Console::log(' Performs a bulk-report request sending a csv file. A valid file name or full path is required.', 'lightgray'); |
||
| 185 | Console::log(); |
||
| 186 | Console::log(Console::text(' -E, --clear ', 'white')); |
||
| 187 | Console::log(' Remove own reports for the given IP address. A valid IPv4 or IPv6 address is required.', 'lightgray'); |
||
| 188 | Console::log(); |
||
| 189 | Console::log(Console::text(' -c, --categories ', 'white') . Console::text('CATEGORIES', 'yellow', 'underline')); |
||
| 190 | Console::log(' For a report request, defines the report category(ies). Categories must be separate by a comma.', 'lightgray'); |
||
| 191 | Console::log(' Some categories cannot be used alone. A category can be represented by its shortname or by its', 'lightgray'); |
||
| 192 | Console::log(Console::text(' id. Use ','lightgray') . Console::text('abuseipdb -L', 'white') . Console::text(' to print the categories list.','lightgray')); |
||
| 193 | Console::log(); |
||
| 194 | Console::log(Console::text(' -m, --message ', 'white') . Console::text('MESSAGE', 'yellow', 'underline')); |
||
| 195 | Console::log(' For a report request, defines the message to send with report. Message is required for all', 'lightgray'); |
||
| 196 | Console::log(' report requests.', 'lightgray'); |
||
| 197 | Console::log(); |
||
| 198 | Console::log(Console::text(' -B, --blacklist ', 'white')); |
||
| 199 | Console::log(' Performs a blacklist request. Default limit is 1000. This limit can ne changed with the', 'lightgray'); |
||
| 200 | Console::log(' ' . Console::text('--limit', 'white') . Console::text(' parameter. ', 'lightgray')); |
||
| 201 | Console::log(); |
||
| 202 | Console::log(Console::text(' -l, --limit ', 'white') . Console::text('LIMIT', 'yellow', 'underline')); |
||
| 203 | Console::log(' For a blacklist request, defines the limit.', 'lightgray'); |
||
| 204 | Console::log(' For a check request with verbose flag, sets the max number of last reports displayed. Default is 10', 'lightgray'); |
||
| 205 | Console::log(' For a check-block request, sets the max number of IPs displayed. Default is 0 (no limit).', 'lightgray'); |
||
| 206 | Console::log(); |
||
| 207 | Console::log(Console::text(' -o, --output ', 'white') . Console::text('FORMAT', 'yellow', 'underline')); |
||
| 208 | Console::log(' Defines the output format for API requests. Default is a colorized report, possible formats are', 'lightgray'); |
||
| 209 | Console::log(' '. Console::text('json', 'yellow', 'underline') . ' or ' . Console::text('plaintext', 'yellow', 'underline') . '. Plaintext option prints partial response (blacklist: IPs list, '); |
||
| 210 | Console::log(' check or report: confidence score only, check-block: reported IPs list with confidence score, ', 'lightgray'); |
||
| 211 | Console::log(' bulk-report: number of saved reports, clear: number of deleted reports).', 'lightgray'); |
||
| 212 | Console::log(); |
||
| 213 | Console::log(Console::text(' -s, --score ', 'white')); |
||
| 214 | Console::log(' For a blacklist request, sets the confidence score minimum. The confidence minimum ', 'lightgray'); |
||
| 215 | Console::log(' must be between 25 and 100. This parameter is subscriber feature (not honored otherwise, allways 100).', 'lightgray'); |
||
| 216 | Console::log(); |
||
| 217 | Console::log(Console::text(' -v, --verbose ', 'white')); |
||
| 218 | Console::log(' For a check request, display additional fields like the x last reports. This increases ', 'lightgray'); |
||
| 219 | Console::log(Console::text(' request time and response size. Max number of last reports displayed can be changed with the ', 'lightgray')); |
||
| 220 | Console::log(' ' . Console::text('--limit', 'white') . Console::text(' parameter. ', 'lightgray')); |
||
| 221 | Console::log(); |
||
| 222 | Console::log(Console::text(' --version', 'white')); |
||
| 223 | Console::log(' Prints the current version. If given, all next arguments are ignored.', 'lightgray'); |
||
| 224 | Console::log(); |
||
| 225 | Console::log(Console::text(' -S, --save-key ', 'white') . Console::text('KEY', 'yellow', 'underline')); |
||
| 226 | Console::log(' Save the given API key in the configuration file. Required writing permissions on the config directory. ', 'lightgray'); |
||
| 227 | Console::log(); |
||
| 228 | } |
||
| 650 | } |