| Conditions | 1 |
| Paths | 1 |
| Total Lines | 125 |
| 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); |
||
| 67 | protected static function printHelp(): void |
||
| 68 | { |
||
| 69 | Console::log(); |
||
| 70 | Console::log(' ' . Console::text('SYNOPSIS:', 'white', 'underline')); |
||
| 71 | Console::log(' ' . Console::text(' abuseipdb -C ') . |
||
| 72 | Console::text('IP', 'yellow') . |
||
| 73 | Console::text(' [-d ') . |
||
| 74 | Console::text('DAYS', 'yellow') . |
||
| 75 | Console::text('] [-v] [-l ') . |
||
| 76 | Console::text('LIMIT', 'yellow') . |
||
| 77 | Console::text('] [-o ') . |
||
| 78 | Console::text('FORMAT', 'yellow') . |
||
| 79 | Console::text(']')); |
||
| 80 | |||
| 81 | Console::log(' ' . Console::text(' abuseipdb -K ') . |
||
| 82 | Console::text('NETWORK', 'yellow') . |
||
| 83 | Console::text(' [-d ') . |
||
| 84 | Console::text('DAYS', 'yellow') . |
||
| 85 | Console::text('] [-o ') . |
||
| 86 | Console::text('FORMAT', 'yellow') . |
||
| 87 | Console::text(']')); |
||
| 88 | |||
| 89 | Console::log(' ' . Console::text(' abuseipdb -R ') . |
||
| 90 | Console::text('IP', 'yellow') . ' -c ' . |
||
| 91 | Console::text('CATEGORIES', 'yellow') . ' -m ' . |
||
| 92 | Console::text('MESSAGE', 'yellow') . |
||
| 93 | Console::text(' [-o ') . |
||
| 94 | Console::text('FORMAT', 'yellow') . |
||
| 95 | Console::text(']')); |
||
| 96 | |||
| 97 | Console::log(' ' . Console::text(' abuseipdb -V ') . |
||
| 98 | Console::text('FILE', 'yellow') . |
||
| 99 | Console::text(' [-o ') . |
||
| 100 | Console::text('FORMAT', 'yellow') . |
||
| 101 | Console::text(']')); |
||
| 102 | |||
| 103 | Console::log(' ' . Console::text(' abuseipdb -E ') . |
||
| 104 | Console::text('IP', 'yellow'). |
||
| 105 | Console::text(' [-o ') . |
||
| 106 | Console::text('FORMAT', 'yellow') . |
||
| 107 | Console::text(']')); |
||
| 108 | |||
| 109 | Console::log(' ' . Console::text(' abuseipdb -B ') . |
||
| 110 | Console::text('[-l ') . |
||
| 111 | Console::text('LIMIT', 'yellow') . |
||
| 112 | Console::text('] [-s ') . |
||
| 113 | Console::text('SCORE', 'yellow') . |
||
| 114 | Console::text('] [-o ') . |
||
| 115 | Console::text('FORMAT', 'yellow') . |
||
| 116 | Console::text(']')); |
||
| 117 | |||
| 118 | Console::log(' ' . Console::text(' abuseipdb -L | -G | -h | --version')); |
||
| 119 | |||
| 120 | Console::log(); |
||
| 121 | Console::log(' ' . Console::text('OPTIONS:', 'white', 'underline')); |
||
| 122 | Console::log(); |
||
| 123 | Console::log(Console::text(' -h, --help', 'white')); |
||
| 124 | Console::log(' Prints the current help.', 'lightgray'); |
||
| 125 | Console::log(); |
||
| 126 | Console::log(Console::text(' -G, --config', 'white')); |
||
| 127 | Console::log(' Prints the current config.', 'lightgray'); |
||
| 128 | Console::log(); |
||
| 129 | Console::log(Console::text(' -L, --list', 'white')); |
||
| 130 | Console::log(' Prints the list report categories.', 'lightgray'); |
||
| 131 | Console::log(); |
||
| 132 | Console::log(Console::text(' -C, --check ', 'white') . Console::text('IP', 'yellow', 'underline')); |
||
| 133 | Console::log(' Performs a check request for the given IP address. A valid IPv4 or IPv6 address is required.', 'lightgray'); |
||
| 134 | Console::log(); |
||
| 135 | Console::log(Console::text(' -K, --check-block ', 'white') . Console::text('NETWORK', 'yellow', 'underline')); |
||
| 136 | Console::log(' Performs a check-block request for the given network. A valid subnet (v4 or v6) denoted with ', 'lightgray'); |
||
| 137 | Console::log(' CIDR notation is required.', 'lightgray'); |
||
| 138 | Console::log(); |
||
| 139 | Console::log(Console::text(' -d, --days ', 'white') . Console::text('DAYS', 'yellow', 'underline')); |
||
| 140 | Console::log(' For a check or check-block request, defines the maxAgeDays. Min is 1, max is 365, default is 30.', 'lightgray'); |
||
| 141 | Console::log(); |
||
| 142 | Console::log(Console::text(' -R, --report ', 'white') . Console::text('IP', 'yellow', 'underline')); |
||
| 143 | Console::log(' Performs a report request for the given IP address. A valid IPv4 or IPv6 address is required.', 'lightgray'); |
||
| 144 | Console::log(); |
||
| 145 | Console::log(Console::text(' -V, --bulk-report ', 'white') . Console::text('FILE', 'yellow', 'underline')); |
||
| 146 | Console::log(' Performs a bulk-report request sending a csv file. A valid file name or full path is required.', 'lightgray'); |
||
| 147 | Console::log(); |
||
| 148 | Console::log(Console::text(' -E, --clear ', 'white')); |
||
| 149 | Console::log(' Remove own reports for the given IP address. A valid IPv4 or IPv6 address is required.', 'lightgray'); |
||
| 150 | Console::log(); |
||
| 151 | Console::log(Console::text(' -c, --categories ', 'white') . Console::text('CATEGORIES', 'yellow', 'underline')); |
||
| 152 | Console::log(' For a report request, defines the report category(ies). Categories must be separate by a comma.', 'lightgray'); |
||
| 153 | Console::log(' Some categories cannot be used alone. A category can be represented by its shortname or by its', 'lightgray'); |
||
| 154 | Console::log(Console::text(' id. Use ','lightgray') . Console::text('abuseipdb -L', 'white') . Console::text(' to print the categories list.','lightgray')); |
||
| 155 | Console::log(); |
||
| 156 | Console::log(Console::text(' -m, --message ', 'white') . Console::text('MESSAGE', 'yellow', 'underline')); |
||
| 157 | Console::log(' For a report request, defines the message to send with report. Message is required for all', 'lightgray'); |
||
| 158 | Console::log(' report requests.', 'lightgray'); |
||
| 159 | Console::log(); |
||
| 160 | Console::log(Console::text(' -B, --blacklist ', 'white')); |
||
| 161 | Console::log(' Performs a blacklist request. Default limit is 1000. This limit can ne changed with the', 'lightgray'); |
||
| 162 | Console::log(' ' . Console::text('--limit', 'white') . Console::text(' parameter. ', 'lightgray')); |
||
| 163 | Console::log(); |
||
| 164 | Console::log(Console::text(' -l, --limit ', 'white') . Console::text('LIMIT', 'yellow', 'underline')); |
||
| 165 | Console::log(' For a blacklist request, defines the limit.', 'lightgray'); |
||
| 166 | Console::log(' For a check request with verbose flag, sets the max number of last reports displayed. Default is 10', 'lightgray'); |
||
| 167 | Console::log(' For a check-block request, sets the max number of IPs displayed. Default is 0 (no limit).', 'lightgray'); |
||
| 168 | Console::log(); |
||
| 169 | Console::log(Console::text(' -o, --output ', 'white') . Console::text('FORMAT', 'yellow', 'underline')); |
||
| 170 | Console::log(' Defines the output format for API requests. Default is a colorized report, possible formats are', 'lightgray'); |
||
| 171 | Console::log(' '. Console::text('json', 'yellow', 'underline') . ' or ' . Console::text('plaintext', 'yellow', 'underline') . '. Plaintext option prints partial response (blacklist: IPs list, '); |
||
| 172 | Console::log(' check or report: confidence score only, check-block: reported IPs list with confidence score, ', 'lightgray'); |
||
| 173 | Console::log(' bulk-report: number of saved reports, clear: number of deleted reports).', 'lightgray'); |
||
| 174 | Console::log(); |
||
| 175 | Console::log(Console::text(' -s, --score ', 'white'). Console::text('SCORE', 'yellow', 'underline')); |
||
| 176 | Console::log(' For a blacklist request, sets the confidence score minimum. The confidence minimum ', 'lightgray'); |
||
| 177 | Console::log(' must be between 25 and 100. This parameter is subscriber feature (not honored otherwise, allways 100).', 'lightgray'); |
||
| 178 | Console::log(); |
||
| 179 | Console::log(Console::text(' -t, --timeout ', 'white'). Console::text('TIMEOUT', 'yellow', 'underline')); |
||
| 180 | Console::log(' Define the timeout in API request and overwrite the value defined in conf.ini or local.ini.', 'lightgray'); |
||
| 181 | Console::log(' Timeout is expressed in milliseconds.', 'lightgray'); |
||
| 182 | Console::log(); |
||
| 183 | Console::log(Console::text(' -v, --verbose ', 'white')); |
||
| 184 | Console::log(' For a check request, display additional fields like the x last reports. This increases ', 'lightgray'); |
||
| 185 | Console::log(Console::text(' request time and response size. Max number of last reports displayed can be changed with the ', 'lightgray')); |
||
| 186 | Console::log(' ' . Console::text('--limit', 'white') . Console::text(' parameter. ', 'lightgray')); |
||
| 187 | Console::log(); |
||
| 188 | Console::log(Console::text(' --version', 'white')); |
||
| 189 | Console::log(' Prints the current version.', 'lightgray'); |
||
| 190 | Console::log(); |
||
| 191 | self::printFooter(); |
||
| 192 | } |
||
| 616 | } |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.