@@ -91,7 +91,7 @@ discard block  | 
                                                    ||
| 91 | 91 | */  | 
                                                        
| 92 | 92 | protected static function inArguments(array $arguments, string $shortArg, string $longArg)  | 
                                                        
| 93 | 93 |      { | 
                                                        
| 94 | - return array_key_exists($shortArg, $arguments) || array_key_exists($longArg, $arguments);  | 
                                                        |
| 94 | + return array_key_exists($shortArg, $arguments) || array_key_exists($longArg, $arguments);  | 
                                                        |
| 95 | 95 | }  | 
                                                        
| 96 | 96 | |
| 97 | 97 | /**  | 
                                                        
@@ -99,10 +99,10 @@ discard block  | 
                                                    ||
| 99 | 99 | *  | 
                                                        
| 100 | 100 | * @access public  | 
                                                        
| 101 | 101 | * @static  | 
                                                        
| 102 | - * @param string $filePath The file's full path  | 
                                                        |
| 103 | - * @param bool $throwError Throw error on true or silent process. Default is true  | 
                                                        |
| 102 | + * @param string $filePath The file's full path  | 
                                                        |
| 103 | + * @param bool $throwError Throw error on true or silent process. Default is true  | 
                                                        |
| 104 | 104 | *  | 
                                                        
| 105 | - * @return object|null  | 
                                                        |
| 105 | + * @return object|null  | 
                                                        |
| 106 | 106 | * @throws \Exception  | 
                                                        
| 107 | 107 | * @throws \LogicException  | 
                                                        
| 108 | 108 | */  | 
                                                        
@@ -110,10 +110,10 @@ discard block  | 
                                                    ||
| 110 | 110 |      { | 
                                                        
| 111 | 111 | // check file exists  | 
                                                        
| 112 | 112 |          if (!file_exists($filePath) || !is_file($filePath)){ | 
                                                        
| 113 | -           if ($throwError) { | 
                                                        |
| 113 | +            if ($throwError) { | 
                                                        |
| 114 | 114 |                  throw new \Exception('Config file not found'); | 
                                                        
| 115 | - }  | 
                                                        |
| 116 | - return null;  | 
                                                        |
| 115 | + }  | 
                                                        |
| 116 | + return null;  | 
                                                        |
| 117 | 117 | }  | 
                                                        
| 118 | 118 | |
| 119 | 119 | // get and parse content  | 
                                                        
@@ -56,7 +56,7 @@ discard block  | 
                                                    ||
| 56 | 56 | protected static function getScoreColor($score)  | 
                                                        
| 57 | 57 |      { | 
                                                        
| 58 | 58 | $score = intval($score);  | 
                                                        
| 59 | - return $score > 50 ? 'lightred' : ($score > 0 ? 'yellow' : 'green') ;  | 
                                                        |
| 59 | + return $score > 50 ? 'lightred' : ($score > 0 ? 'yellow' : 'green');  | 
                                                        |
| 60 | 60 | }  | 
                                                        
| 61 | 61 | |
| 62 | 62 | |
@@ -74,8 +74,7 @@ discard block  | 
                                                    ||
| 74 | 74 | */  | 
                                                        
| 75 | 75 | protected static function getArgumentValue(array $arguments, string $shortArg, string $longArg)  | 
                                                        
| 76 | 76 |      { | 
                                                        
| 77 | - return (array_key_exists($shortArg, $arguments) ? $arguments[$shortArg] :  | 
                                                        |
| 78 | - (array_key_exists($longArg, $arguments) ? $arguments[$longArg] : ''));  | 
                                                        |
| 77 | + return (array_key_exists($shortArg, $arguments) ? $arguments[$shortArg] : (array_key_exists($longArg, $arguments) ? $arguments[$longArg] : ''));  | 
                                                        |
| 79 | 78 | }  | 
                                                        
| 80 | 79 | |
| 81 | 80 | /**  | 
                                                        
@@ -109,7 +108,7 @@ discard block  | 
                                                    ||
| 109 | 108 | protected static function loadJsonFile(string $filePath, bool $throwError = true)  | 
                                                        
| 110 | 109 |      { | 
                                                        
| 111 | 110 | // check file exists  | 
                                                        
| 112 | -        if (!file_exists($filePath) || !is_file($filePath)){ | 
                                                        |
| 111 | +        if (!file_exists($filePath) || !is_file($filePath)) { | 
                                                        |
| 113 | 112 |             if ($throwError) { | 
                                                        
| 114 | 113 |                  throw new \Exception('Config file not found'); | 
                                                        
| 115 | 114 | }  | 
                                                        
@@ -105,38 +105,38 @@  | 
                                                    ||
| 105 | 105 | |
| 106 | 106 |          Console::log(' ' . Console::text('SYNOPSIS:', 'white', 'underline'));  | 
                                                        
| 107 | 107 |          Console::log(' ' . Console::text('    abuseipdb -C ') .  | 
                                                        
| 108 | -                           Console::text('IP', 'yellow') .  | 
                                                        |
| 109 | -                           Console::text(' [-d ') .  | 
                                                        |
| 110 | -                           Console::text('DAYS', 'yellow') .  | 
                                                        |
| 111 | -                           Console::text('] [-v] [-l ') .  | 
                                                        |
| 112 | -                           Console::text('LIMIT', 'yellow') .  | 
                                                        |
| 113 | -                           Console::text(']'));  | 
                                                        |
| 108 | +                            Console::text('IP', 'yellow') .  | 
                                                        |
| 109 | +                            Console::text(' [-d ') .  | 
                                                        |
| 110 | +                            Console::text('DAYS', 'yellow') .  | 
                                                        |
| 111 | +                            Console::text('] [-v] [-l ') .  | 
                                                        |
| 112 | +                            Console::text('LIMIT', 'yellow') .  | 
                                                        |
| 113 | +                            Console::text(']'));  | 
                                                        |
| 114 | 114 | |
| 115 | 115 |          Console::log(' ' . Console::text('    abuseipdb -K ') .  | 
                                                        
| 116 | -                           Console::text('NETWORK', 'yellow') .  | 
                                                        |
| 117 | -                           Console::text(' [-d ') .  | 
                                                        |
| 118 | -                           Console::text('DAYS', 'yellow') .  | 
                                                        |
| 119 | -                           Console::text(']'));  | 
                                                        |
| 116 | +                            Console::text('NETWORK', 'yellow') .  | 
                                                        |
| 117 | +                            Console::text(' [-d ') .  | 
                                                        |
| 118 | +                            Console::text('DAYS', 'yellow') .  | 
                                                        |
| 119 | +                            Console::text(']'));  | 
                                                        |
| 120 | 120 | |
| 121 | 121 |          Console::log(' ' . Console::text('    abuseipdb -R ' . | 
                                                        
| 122 | -                           Console::text('IP', 'yellow') . ' -c ' . | 
                                                        |
| 123 | -                           Console::text('CATEGORIES', 'yellow') . ' -m ' . | 
                                                        |
| 124 | -                           Console::text('MESSAGE', 'yellow')));  | 
                                                        |
| 122 | +                            Console::text('IP', 'yellow') . ' -c ' . | 
                                                        |
| 123 | +                            Console::text('CATEGORIES', 'yellow') . ' -m ' . | 
                                                        |
| 124 | +                            Console::text('MESSAGE', 'yellow')));  | 
                                                        |
| 125 | 125 | |
| 126 | 126 |          Console::log(' ' . Console::text('    abuseipdb -V ' . | 
                                                        
| 127 | -                           Console::text('FILE', 'yellow'))); | 
                                                        |
| 127 | +                            Console::text('FILE', 'yellow'))); | 
                                                        |
| 128 | 128 | |
| 129 | 129 |          Console::log(' ' . Console::text('    abuseipdb -E ' . | 
                                                        
| 130 | -                           Console::text('IP', 'yellow'))); | 
                                                        |
| 130 | +                            Console::text('IP', 'yellow'))); | 
                                                        |
| 131 | 131 | |
| 132 | 132 |          Console::log(' ' . Console::text('    abuseipdb -B ') .  | 
                                                        
| 133 | -                           Console::text('[-l ') .  | 
                                                        |
| 134 | -                           Console::text('LIMIT', 'yellow') .  | 
                                                        |
| 135 | -                           Console::text('] [-s ') .  | 
                                                        |
| 136 | -                           Console::text('SCORE', 'yellow') .  | 
                                                        |
| 137 | -                           Console::text('] [-p ') .  | 
                                                        |
| 138 | -                           Console::text('', 'yellow') .  | 
                                                        |
| 139 | -                           Console::text(']'));  | 
                                                        |
| 133 | +                            Console::text('[-l ') .  | 
                                                        |
| 134 | +                            Console::text('LIMIT', 'yellow') .  | 
                                                        |
| 135 | +                            Console::text('] [-s ') .  | 
                                                        |
| 136 | +                            Console::text('SCORE', 'yellow') .  | 
                                                        |
| 137 | +                            Console::text('] [-p ') .  | 
                                                        |
| 138 | +                            Console::text('', 'yellow') .  | 
                                                        |
| 139 | +                            Console::text(']'));  | 
                                                        |
| 140 | 140 | |
| 141 | 141 |          Console::log(' ' . Console::text('    abuseipdb -L | -G | -h | --version')); | 
                                                        
| 142 | 142 | |
@@ -49,7 +49,7 @@ discard block  | 
                                                    ||
| 49 | 49 |      { | 
                                                        
| 50 | 50 | // required at least one valid argument  | 
                                                        
| 51 | 51 | self::$keyPath = $keyPath;  | 
                                                        
| 52 | - self::validate( !empty($arguments), 'No valid arguments given. Run abuseipdb --help to get help.');  | 
                                                        |
| 52 | + self::validate(!empty($arguments), 'No valid arguments given. Run abuseipdb --help to get help.');  | 
                                                        |
| 53 | 53 |          if (!self::parseCommand($arguments, $keyPath)) { | 
                                                        
| 54 | 54 |              self::error('Invalid arguments. Run abuseipdb --help to get help.'); | 
                                                        
| 55 | 55 | self::printFooter();  | 
                                                        
@@ -70,9 +70,9 @@ discard block  | 
                                                    ||
| 70 | 70 |      { | 
                                                        
| 71 | 71 |          self::printTitle(Console::text('  ► Register API key ', 'darkgray')); | 
                                                        
| 72 | 72 | |
| 73 | - $key = self::getArgumentValue($arguments,'S', 'save-key');  | 
                                                        |
| 73 | + $key = self::getArgumentValue($arguments, 'S', 'save-key');  | 
                                                        |
| 74 | 74 | |
| 75 | -        if (empty($key)){ | 
                                                        |
| 75 | +        if (empty($key)) { | 
                                                        |
| 76 | 76 |              self::error('Null or invalid key argument.'); | 
                                                        
| 77 | 77 | self::printFooter();  | 
                                                        
| 78 | 78 | Program::exit(1);  | 
                                                        
@@ -80,12 +80,12 @@ discard block  | 
                                                    ||
| 80 | 80 | |
| 81 | 81 | $data = json_encode(['api_key' => $key]);  | 
                                                        
| 82 | 82 | |
| 83 | -        if (file_put_contents(self::$keyPath, $data, LOCK_EX) === false){ | 
                                                        |
| 83 | +        if (file_put_contents(self::$keyPath, $data, LOCK_EX) === false) { | 
                                                        |
| 84 | 84 |              self::error('An error occured during writing config file. Make sure to give the appropriate permissions do the config directory.'); | 
                                                        
| 85 | 85 | self::printFooter();  | 
                                                        
| 86 | 86 | Program::exit(1);  | 
                                                        
| 87 | 87 | }  | 
                                                        
| 88 | -        Console::log(Console::text('  ✓ ', 'green') . Console::text('Your config key file has been successfully created.', 'white')); | 
                                                        |
| 88 | +        Console::log(Console::text('  ✓ ', 'green').Console::text('Your config key file has been successfully created.', 'white')); | 
                                                        |
| 89 | 89 | Console::log();  | 
                                                        
| 90 | 90 | self::printFooter();  | 
                                                        
| 91 | 91 | Program::exit();  | 
                                                        
@@ -103,45 +103,45 @@ discard block  | 
                                                    ||
| 103 | 103 |      { | 
                                                        
| 104 | 104 | self::printBanner();  | 
                                                        
| 105 | 105 | |
| 106 | -        Console::log(' ' . Console::text('SYNOPSIS:', 'white', 'underline'));  | 
                                                        |
| 107 | -        Console::log(' ' . Console::text('    abuseipdb -C ') .  | 
                                                        |
| 108 | -                           Console::text('IP', 'yellow') .  | 
                                                        |
| 109 | -                           Console::text(' [-d ') .  | 
                                                        |
| 110 | -                           Console::text('DAYS', 'yellow') .  | 
                                                        |
| 111 | -                           Console::text('] [-v] [-l ') .  | 
                                                        |
| 112 | -                           Console::text('LIMIT', 'yellow') .  | 
                                                        |
| 106 | +        Console::log(' '.Console::text('SYNOPSIS:', 'white', 'underline'));  | 
                                                        |
| 107 | +        Console::log(' '.Console::text('    abuseipdb -C ').  | 
                                                        |
| 108 | +                           Console::text('IP', 'yellow').  | 
                                                        |
| 109 | +                           Console::text(' [-d ').  | 
                                                        |
| 110 | +                           Console::text('DAYS', 'yellow').  | 
                                                        |
| 111 | +                           Console::text('] [-v] [-l ').  | 
                                                        |
| 112 | +                           Console::text('LIMIT', 'yellow').  | 
                                                        |
| 113 | 113 |                             Console::text(']'));  | 
                                                        
| 114 | 114 | |
| 115 | -        Console::log(' ' . Console::text('    abuseipdb -K ') .  | 
                                                        |
| 116 | -                           Console::text('NETWORK', 'yellow') .  | 
                                                        |
| 117 | -                           Console::text(' [-d ') .  | 
                                                        |
| 118 | -                           Console::text('DAYS', 'yellow') .  | 
                                                        |
| 115 | +        Console::log(' '.Console::text('    abuseipdb -K ').  | 
                                                        |
| 116 | +                           Console::text('NETWORK', 'yellow').  | 
                                                        |
| 117 | +                           Console::text(' [-d ').  | 
                                                        |
| 118 | +                           Console::text('DAYS', 'yellow').  | 
                                                        |
| 119 | 119 |                             Console::text(']'));  | 
                                                        
| 120 | 120 | |
| 121 | -        Console::log(' ' . Console::text('    abuseipdb -R ' . | 
                                                        |
| 122 | -                           Console::text('IP', 'yellow') . ' -c ' . | 
                                                        |
| 123 | -                           Console::text('CATEGORIES', 'yellow') . ' -m ' . | 
                                                        |
| 121 | +        Console::log(' '.Console::text('    abuseipdb -R '. | 
                                                        |
| 122 | +                           Console::text('IP', 'yellow').' -c '. | 
                                                        |
| 123 | +                           Console::text('CATEGORIES', 'yellow').' -m '. | 
                                                        |
| 124 | 124 |                             Console::text('MESSAGE', 'yellow')));  | 
                                                        
| 125 | 125 | |
| 126 | -        Console::log(' ' . Console::text('    abuseipdb -V ' . | 
                                                        |
| 126 | +        Console::log(' '.Console::text('    abuseipdb -V '. | 
                                                        |
| 127 | 127 |                             Console::text('FILE', 'yellow'))); | 
                                                        
| 128 | 128 | |
| 129 | -        Console::log(' ' . Console::text('    abuseipdb -E ' . | 
                                                        |
| 129 | +        Console::log(' '.Console::text('    abuseipdb -E '. | 
                                                        |
| 130 | 130 |                             Console::text('IP', 'yellow'))); | 
                                                        
| 131 | 131 | |
| 132 | -        Console::log(' ' . Console::text('    abuseipdb -B ') .  | 
                                                        |
| 133 | -                           Console::text('[-l ') .  | 
                                                        |
| 134 | -                           Console::text('LIMIT', 'yellow') .  | 
                                                        |
| 135 | -                           Console::text('] [-s ') .  | 
                                                        |
| 136 | -                           Console::text('SCORE', 'yellow') .  | 
                                                        |
| 137 | -                           Console::text('] [-p ') .  | 
                                                        |
| 138 | -                           Console::text('', 'yellow') .  | 
                                                        |
| 132 | +        Console::log(' '.Console::text('    abuseipdb -B ').  | 
                                                        |
| 133 | +                           Console::text('[-l ').  | 
                                                        |
| 134 | +                           Console::text('LIMIT', 'yellow').  | 
                                                        |
| 135 | +                           Console::text('] [-s ').  | 
                                                        |
| 136 | +                           Console::text('SCORE', 'yellow').  | 
                                                        |
| 137 | +                           Console::text('] [-p ').  | 
                                                        |
| 138 | +                           Console::text('', 'yellow').  | 
                                                        |
| 139 | 139 |                             Console::text(']'));  | 
                                                        
| 140 | 140 | |
| 141 | -        Console::log(' ' . Console::text('    abuseipdb -L | -G | -h | --version')); | 
                                                        |
| 141 | +        Console::log(' '.Console::text('    abuseipdb -L | -G | -h | --version')); | 
                                                        |
| 142 | 142 | |
| 143 | 143 | Console::log();  | 
                                                        
| 144 | -        Console::log(' ' . Console::text('OPTIONS:', 'white', 'underline'));  | 
                                                        |
| 144 | +        Console::log(' '.Console::text('OPTIONS:', 'white', 'underline'));  | 
                                                        |
| 145 | 145 | Console::log();  | 
                                                        
| 146 | 146 |          Console::log(Console::text('   -h, --help', 'white'));  | 
                                                        
| 147 | 147 |          Console::log('       Prints the current help. If given, all next arguments are ignored.', 'lightgray'); | 
                                                        
@@ -152,39 +152,39 @@ discard block  | 
                                                    ||
| 152 | 152 |          Console::log(Console::text('   -L, --list', 'white'));  | 
                                                        
| 153 | 153 |          Console::log('       Prints the list report categories. If given, all next arguments are ignored.', 'lightgray'); | 
                                                        
| 154 | 154 | Console::log();  | 
                                                        
| 155 | -        Console::log(Console::text('   -C, --check ', 'white') . Console::text('ip', 'yellow', 'underline'));  | 
                                                        |
| 155 | +        Console::log(Console::text('   -C, --check ', 'white').Console::text('ip', 'yellow', 'underline'));  | 
                                                        |
| 156 | 156 |          Console::log('       Performs a check request for the given IP address. A valid IPv4 or IPv6 address is required.', 'lightgray'); | 
                                                        
| 157 | 157 | Console::log();  | 
                                                        
| 158 | -        Console::log(Console::text('   -K, --check-block ', 'white') . Console::text('network', 'yellow', 'underline'));  | 
                                                        |
| 158 | +        Console::log(Console::text('   -K, --check-block ', 'white').Console::text('network', 'yellow', 'underline'));  | 
                                                        |
| 159 | 159 |          Console::log('       Performs a check-block request for the given network. A valid subnet (v4 or v6) denoted with ', 'lightgray'); | 
                                                        
| 160 | 160 |          Console::log('       CIDR notation is required.', 'lightgray'); | 
                                                        
| 161 | 161 | Console::log();  | 
                                                        
| 162 | -        Console::log(Console::text('   -d, --days ', 'white') . Console::text('days', 'yellow', 'underline'));  | 
                                                        |
| 162 | +        Console::log(Console::text('   -d, --days ', 'white').Console::text('days', 'yellow', 'underline'));  | 
                                                        |
| 163 | 163 |          Console::log('       For a check or check-block request, defines the maxAgeDays. Min is 1, max is 365, default is 30.', 'lightgray'); | 
                                                        
| 164 | 164 | Console::log();  | 
                                                        
| 165 | -        Console::log(Console::text('   -R, --report ', 'white') . Console::text('ip', 'yellow', 'underline'));  | 
                                                        |
| 165 | +        Console::log(Console::text('   -R, --report ', 'white').Console::text('ip', 'yellow', 'underline'));  | 
                                                        |
| 166 | 166 |          Console::log('       Performs a report request for the given IP address. A valid IPv4 or IPv6 address is required.', 'lightgray'); | 
                                                        
| 167 | 167 | Console::log();  | 
                                                        
| 168 | -        Console::log(Console::text('   -V, --bulk-report ', 'white') . Console::text('path', 'yellow', 'underline'));  | 
                                                        |
| 168 | +        Console::log(Console::text('   -V, --bulk-report ', 'white').Console::text('path', 'yellow', 'underline'));  | 
                                                        |
| 169 | 169 |          Console::log('       Performs a bulk-report request sending a csv file. A valid file name or full path is required.', 'lightgray'); | 
                                                        
| 170 | 170 | Console::log();  | 
                                                        
| 171 | 171 |          Console::log(Console::text('   -E, --clear ', 'white'));  | 
                                                        
| 172 | 172 |          Console::log('       Remove own reports for the given IP address. A valid IPv4 or IPv6 address is required.', 'lightgray'); | 
                                                        
| 173 | 173 | Console::log();  | 
                                                        
| 174 | -        Console::log(Console::text('   -c, --categories ', 'white') . Console::text('categories', 'yellow', 'underline'));  | 
                                                        |
| 174 | +        Console::log(Console::text('   -c, --categories ', 'white').Console::text('categories', 'yellow', 'underline'));  | 
                                                        |
| 175 | 175 |          Console::log('       For a report request, defines the report category(ies). Categories must be separate by a comma.', 'lightgray'); | 
                                                        
| 176 | 176 |          Console::log('       Some categories cannot be used alone. A category can be represented by its shortname or by its', 'lightgray'); | 
                                                        
| 177 | -        Console::log(Console::text('       id. Use ','lightgray')  . Console::text('abuseipdb -L', 'white') . Console::text(' to print the categories list.','lightgray')); | 
                                                        |
| 177 | +        Console::log(Console::text('       id. Use ', 'lightgray').Console::text('abuseipdb -L', 'white').Console::text(' to print the categories list.', 'lightgray')); | 
                                                        |
| 178 | 178 | Console::log();  | 
                                                        
| 179 | -        Console::log(Console::text('   -m, --message ', 'white') . Console::text('message', 'yellow', 'underline'));  | 
                                                        |
| 179 | +        Console::log(Console::text('   -m, --message ', 'white').Console::text('message', 'yellow', 'underline'));  | 
                                                        |
| 180 | 180 |          Console::log('       For a report request, defines the message to send with report. Message is required for all', 'lightgray'); | 
                                                        
| 181 | 181 |          Console::log('       report requests.', 'lightgray'); | 
                                                        
| 182 | 182 | Console::log();  | 
                                                        
| 183 | 183 |          Console::log(Console::text('   -B, --blacklist ', 'white'));  | 
                                                        
| 184 | 184 |          Console::log('       Performs a blacklist request. Default limit is 1000. This limit can ne changed with the', 'lightgray'); | 
                                                        
| 185 | -        Console::log('       ' . Console::text('--limit', 'white') . Console::text(' parameter. ', 'lightgray')); | 
                                                        |
| 185 | +        Console::log('       '.Console::text('--limit', 'white').Console::text(' parameter. ', 'lightgray')); | 
                                                        |
| 186 | 186 | Console::log();  | 
                                                        
| 187 | -        Console::log(Console::text('   -l, --limit ', 'white') . Console::text('limit', 'yellow', 'underline'));  | 
                                                        |
| 187 | +        Console::log(Console::text('   -l, --limit ', 'white').Console::text('limit', 'yellow', 'underline'));  | 
                                                        |
| 188 | 188 |          Console::log('       For a blacklist request, defines the limit.', 'lightgray'); | 
                                                        
| 189 | 189 |          Console::log('       For a check request with verbose flag, sets the max number of last reports displayed. Default is 10', 'lightgray'); | 
                                                        
| 190 | 190 |          Console::log('       For a check-block request, sets the max number of IPs displayed. Default is 0 (no limit).', 'lightgray'); | 
                                                        
@@ -199,7 +199,7 @@ discard block  | 
                                                    ||
| 199 | 199 |          Console::log(Console::text('   -v, --verbose ', 'white'));  | 
                                                        
| 200 | 200 |          Console::log('       For a check request, display additional fields like the x last reports. This increases ', 'lightgray'); | 
                                                        
| 201 | 201 |          Console::log(Console::text('       request time and response size. Max number of last reports displayed can be changed with the ', 'lightgray')); | 
                                                        
| 202 | -        Console::log('       ' . Console::text('--limit', 'white') . Console::text(' parameter. ', 'lightgray')); | 
                                                        |
| 202 | +        Console::log('       '.Console::text('--limit', 'white').Console::text(' parameter. ', 'lightgray')); | 
                                                        |
| 203 | 203 | Console::log();  | 
                                                        
| 204 | 204 |          Console::log(Console::text('   --version', 'white'));  | 
                                                        
| 205 | 205 |          Console::log('       Prints the current version. If given, all next arguments are ignored.', 'lightgray'); | 
                                                        
@@ -220,11 +220,11 @@ discard block  | 
                                                    ||
| 220 | 220 | |
| 221 | 221 |          self::printTitle(Console::text('  ► Current configuration ', 'darkgray')); | 
                                                        
| 222 | 222 | |
| 223 | -        Console::log(Console::text('  api_key:[', 'white') . Console::text($conf['apiKey'], 'green') . Console::text(']', 'white')); | 
                                                        |
| 223 | +        Console::log(Console::text('  api_key:[', 'white').Console::text($conf['apiKey'], 'green').Console::text(']', 'white')); | 
                                                        |
| 224 | 224 |          Console::log(Console::text('  self_ips:', 'white')); | 
                                                        
| 225 | 225 | |
| 226 | 226 |          foreach ($conf['selfIps'] as $ip) { | 
                                                        
| 227 | -            Console::log(Console::text('    [', 'white') . Console::text($ip, 'green') . Console::text(']', 'white'));    | 
                                                        |
| 227 | +            Console::log(Console::text('    [', 'white').Console::text($ip, 'green').Console::text(']', 'white'));    | 
                                                        |
| 228 | 228 | }  | 
                                                        
| 229 | 229 | |
| 230 | 230 | Console::log();  | 
                                                        
@@ -245,10 +245,10 @@ discard block  | 
                                                    ||
| 245 | 245 | |
| 246 | 246 | $categories = ApiHandler::getCategories();  | 
                                                        
| 247 | 247 | $rowHeaders = [  | 
                                                        
| 248 | -            Console::text('ShortName',      'darkgray') => 15,  | 
                                                        |
| 249 | -            Console::text('Id',             'darkgray') => 2,  | 
                                                        |
| 250 | -            Console::text('Full name',      'darkgray') => 18, | 
                                                        |
| 251 | -            Console::text('Can be alone?',  'darkgray') => 15 | 
                                                        |
| 248 | +            Console::text('ShortName', 'darkgray') => 15,  | 
                                                        |
| 249 | +            Console::text('Id', 'darkgray') => 2,  | 
                                                        |
| 250 | +            Console::text('Full name', 'darkgray') => 18, | 
                                                        |
| 251 | +            Console::text('Can be alone?', 'darkgray') => 15 | 
                                                        |
| 252 | 252 | ];  | 
                                                        
| 253 | 253 | Console::$verticalSeparator = ' ';  | 
                                                        
| 254 | 254 | Console::$verticalInnerSeparator = ' ';  | 
                                                        
@@ -258,17 +258,16 @@ discard block  | 
                                                    ||
| 258 | 258 | |
| 259 | 259 |          foreach ($categories as $cat) { | 
                                                        
| 260 | 260 | $id = Console::text($cat[1], 'white');  | 
                                                        
| 261 | -            $standalone = $cat[3] ? Console::text('✓', 'green') . Console::text(' true ', 'lightgray') :  | 
                                                        |
| 262 | -                                    Console::text('✗', 'red')   . Console::text(' false', 'darkgray'); | 
                                                        |
| 263 | - $shortName = Console::text($cat[0], 'white');  | 
                                                        |
| 264 | - $fullName = Console::text($cat[2], 'lightgray');  | 
                                                        |
| 261 | +            $standalone = $cat[3] ? Console::text('✓', 'green').Console::text(' true ', 'lightgray') : Console::text('✗', 'red').Console::text(' false', 'darkgray'); | 
                                                        |
| 262 | + $shortName = Console::text($cat[0], 'white');  | 
                                                        |
| 263 | + $fullName = Console::text($cat[2], 'lightgray');  | 
                                                        |
| 265 | 264 | |
| 266 | 265 | Console::log(  | 
                                                        
| 267 | 266 | Console::TableRowStart().  | 
                                                        
| 268 | - Console::TableRowCell( $shortName , 15).  | 
                                                        |
| 269 | - Console::TableRowCell( $id , 2, Console::ALIGN_CENTER).  | 
                                                        |
| 270 | - Console::TableRowCell( $fullName , 18).  | 
                                                        |
| 271 | - Console::TableRowCell( $standalone , 15, Console::ALIGN_CENTER)  | 
                                                        |
| 267 | + Console::TableRowCell($shortName, 15).  | 
                                                        |
| 268 | + Console::TableRowCell($id, 2, Console::ALIGN_CENTER).  | 
                                                        |
| 269 | + Console::TableRowCell($fullName, 18).  | 
                                                        |
| 270 | + Console::TableRowCell($standalone, 15, Console::ALIGN_CENTER)  | 
                                                        |
| 272 | 271 | );  | 
                                                        
| 273 | 272 | }  | 
                                                        
| 274 | 273 | //Console::log(Console::tableRowSeparator($rowHeaders), 'darkgray');  | 
                                                        
@@ -287,11 +286,11 @@ discard block  | 
                                                    ||
| 287 | 286 | */  | 
                                                        
| 288 | 287 | protected static function reportIP(array $arguments)  | 
                                                        
| 289 | 288 |      { | 
                                                        
| 290 | - $ip = self::getArgumentValue($arguments,'R', 'report');  | 
                                                        |
| 291 | - $cats = self::getArgumentValue($arguments,'c', 'categories');  | 
                                                        |
| 292 | - $message = self::getArgumentValue($arguments,'m', 'message');  | 
                                                        |
| 289 | + $ip = self::getArgumentValue($arguments, 'R', 'report');  | 
                                                        |
| 290 | + $cats = self::getArgumentValue($arguments, 'c', 'categories');  | 
                                                        |
| 291 | + $message = self::getArgumentValue($arguments, 'm', 'message');  | 
                                                        |
| 293 | 292 | |
| 294 | -        self::printTitle(Console::text('  ► Report IP: ', 'darkgray') . Console::text(escapeshellcmd($ip), 'white')); | 
                                                        |
| 293 | +        self::printTitle(Console::text('  ► Report IP: ', 'darkgray').Console::text(escapeshellcmd($ip), 'white')); | 
                                                        |
| 295 | 294 | self::printTempMessage();  | 
                                                        
| 296 | 295 | |
| 297 | 296 | // Peforms request  | 
                                                        
@@ -302,7 +301,7 @@ discard block  | 
                                                    ||
| 302 | 301 | self::clearTempMessage();  | 
                                                        
| 303 | 302 | |
| 304 | 303 | // check for errors / empty response  | 
                                                        
| 305 | -        if (self::printErrors($report)){ | 
                                                        |
| 304 | +        if (self::printErrors($report)) { | 
                                                        |
| 306 | 305 | self::printFooter();  | 
                                                        
| 307 | 306 | Program::exit(1);  | 
                                                        
| 308 | 307 | }  | 
                                                        
@@ -311,23 +310,23 @@ discard block  | 
                                                    ||
| 311 | 310 | $score = empty($report->data->abuseConfidenceScore) ? 0 : $report->data->abuseConfidenceScore;  | 
                                                        
| 312 | 311 | $scoreColor = self::getScoreColor($score);  | 
                                                        
| 313 | 312 | |
| 314 | -        switch (self::$outputFormat){ | 
                                                        |
| 313 | +        switch (self::$outputFormat) { | 
                                                        |
| 315 | 314 | case self::OUTPUT_JSON:  | 
                                                        
| 316 | 315 | echo json_encode($report, JSON_PRETTY_PRINT);  | 
                                                        
| 317 | 316 | break;  | 
                                                        
| 318 | 317 | |
| 319 | 318 | case self::OUTPUT_DEFAULT:  | 
                                                        
| 320 | 319 | Console::log(  | 
                                                        
| 321 | -                    Console::text('   ✓', 'green') . Console::text(' IP: [', 'white') . | 
                                                        |
| 322 | -                    Console::text($ip, $scoreColor) . Console::text('] successfully reported', 'white') | 
                                                        |
| 320 | +                    Console::text('   ✓', 'green').Console::text(' IP: [', 'white'). | 
                                                        |
| 321 | +                    Console::text($ip, $scoreColor).Console::text('] successfully reported', 'white') | 
                                                        |
| 323 | 322 | );  | 
                                                        
| 324 | -                Console::log(Console::text('     Confidence score: ', 'white') . self::getScoreBadge($score)); | 
                                                        |
| 323 | +                Console::log(Console::text('     Confidence score: ', 'white').self::getScoreBadge($score)); | 
                                                        |
| 325 | 324 | Console::log();  | 
                                                        
| 326 | 325 | self::printFooter($time);  | 
                                                        
| 327 | 326 | break;  | 
                                                        
| 328 | 327 | |
| 329 | 328 | case self::OUTPUT_PLAINTEXT:  | 
                                                        
| 330 | - echo $score . PHP_EOL;  | 
                                                        |
| 329 | + echo $score.PHP_EOL;  | 
                                                        |
| 331 | 330 | break;  | 
                                                        
| 332 | 331 | |
| 333 | 332 | }  | 
                                                        
@@ -344,26 +343,26 @@ discard block  | 
                                                    ||
| 344 | 343 | */  | 
                                                        
| 345 | 344 | protected static function bulkReport(array $arguments)  | 
                                                        
| 346 | 345 |      { | 
                                                        
| 347 | - $fileName = self::getArgumentValue($arguments,'V', 'bulk-report');  | 
                                                        |
| 346 | + $fileName = self::getArgumentValue($arguments, 'V', 'bulk-report');  | 
                                                        |
| 348 | 347 | |
| 349 | -        self::printTitle(Console::text('  ► Bulk report for file: ', 'darkgray') . Console::text(escapeshellcmd($fileName), 'white')); | 
                                                        |
| 348 | +        self::printTitle(Console::text('  ► Bulk report for file: ', 'darkgray').Console::text(escapeshellcmd($fileName), 'white')); | 
                                                        |
| 350 | 349 | self::printTempMessage();  | 
                                                        
| 351 | 350 | |
| 352 | 351 | // Peforms request  | 
                                                        
| 353 | 352 | $timeStart = microtime(true);  | 
                                                        
| 354 | 353 | $response = self::$api->bulkReport($fileName)->getObject();  | 
                                                        
| 355 | 354 | $timeEnd = microtime(true);  | 
                                                        
| 356 | - $time = $timeEnd - $timeStart; // request time  | 
                                                        |
| 355 | + $time = $timeEnd - $timeStart; // request time  | 
                                                        |
| 357 | 356 | self::clearTempMessage();  | 
                                                        
| 358 | 357 | |
| 359 | 358 | // check for errors / empty response  | 
                                                        
| 360 | -        if (self::printErrors($response)){ | 
                                                        |
| 359 | +        if (self::printErrors($response)) { | 
                                                        |
| 361 | 360 | self::printFooter();  | 
                                                        
| 362 | 361 | Program::exit(1);  | 
                                                        
| 363 | 362 | }  | 
                                                        
| 364 | 363 | |
| 365 | 364 | // ✓ Done  | 
                                                        
| 366 | -        switch (self::$outputFormat){ | 
                                                        |
| 365 | +        switch (self::$outputFormat) { | 
                                                        |
| 367 | 366 | case self::OUTPUT_JSON:  | 
                                                        
| 368 | 367 | echo json_encode($response, JSON_PRETTY_PRINT);  | 
                                                        
| 369 | 368 | break;  | 
                                                        
@@ -376,7 +375,7 @@ discard block  | 
                                                    ||
| 376 | 375 | |
| 377 | 376 | case self::OUTPUT_PLAINTEXT:  | 
                                                        
| 378 | 377 | $nbSavedReports = isset($response->data->savedReports) ? $response->data->savedReports : 0;  | 
                                                        
| 379 | - echo $nbSavedReports . PHP_EOL;  | 
                                                        |
| 378 | + echo $nbSavedReports.PHP_EOL;  | 
                                                        |
| 380 | 379 | break;  | 
                                                        
| 381 | 380 | |
| 382 | 381 | }  | 
                                                        
@@ -393,8 +392,8 @@ discard block  | 
                                                    ||
| 393 | 392 | */  | 
                                                        
| 394 | 393 | protected static function clearIP(array $arguments)  | 
                                                        
| 395 | 394 |      { | 
                                                        
| 396 | - $ip = self::getArgumentValue($arguments,'E', 'clear');  | 
                                                        |
| 397 | -        self::printTitle(Console::text('  ► Clear reports for IP: ', 'darkgray') . Console::text(escapeshellcmd($ip), 'white')); | 
                                                        |
| 395 | + $ip = self::getArgumentValue($arguments, 'E', 'clear');  | 
                                                        |
| 396 | +        self::printTitle(Console::text('  ► Clear reports for IP: ', 'darkgray').Console::text(escapeshellcmd($ip), 'white')); | 
                                                        |
| 398 | 397 | |
| 399 | 398 | // Peforms request  | 
                                                        
| 400 | 399 | self::printTempMessage();  | 
                                                        
@@ -405,22 +404,22 @@ discard block  | 
                                                    ||
| 405 | 404 | self::clearTempMessage();  | 
                                                        
| 406 | 405 | |
| 407 | 406 | // check for errors / empty response  | 
                                                        
| 408 | -        if (self::printErrors($response)){ | 
                                                        |
| 407 | +        if (self::printErrors($response)) { | 
                                                        |
| 409 | 408 | self::printFooter($time);  | 
                                                        
| 410 | 409 | Program::exit(1);  | 
                                                        
| 411 | 410 | }  | 
                                                        
| 412 | 411 | |
| 413 | 412 | // ✓ Done: print deleted report number  | 
                                                        
| 414 | -        switch (self::$outputFormat){ | 
                                                        |
| 413 | +        switch (self::$outputFormat) { | 
                                                        |
| 415 | 414 | case self::OUTPUT_JSON:  | 
                                                        
| 416 | 415 | echo json_encode($response, JSON_PRETTY_PRINT);  | 
                                                        
| 417 | 416 | break;  | 
                                                        
| 418 | 417 | |
| 419 | 418 | case self::OUTPUT_DEFAULT:  | 
                                                        
| 420 | 419 | Console::log(  | 
                                                        
| 421 | -                    Console::text('   ✓', 'green') .  | 
                                                        |
| 422 | -                    Console::text(' Successfull clear request for IP: [', 'white') . | 
                                                        |
| 423 | - Console::text($ip, 'lightyellow') .  | 
                                                        |
| 420 | +                    Console::text('   ✓', 'green').  | 
                                                        |
| 421 | +                    Console::text(' Successfull clear request for IP: [', 'white'). | 
                                                        |
| 422 | + Console::text($ip, 'lightyellow').  | 
                                                        |
| 424 | 423 |                      Console::text(']', 'white') | 
                                                        
| 425 | 424 | );  | 
                                                        
| 426 | 425 |                  self::printResult('     Deleted reports: ', $response->data->numReportsDeleted ?? 0, 'lightyellow'); | 
                                                        
@@ -429,7 +428,7 @@ discard block  | 
                                                    ||
| 429 | 428 | break;  | 
                                                        
| 430 | 429 | |
| 431 | 430 | case self::OUTPUT_PLAINTEXT:  | 
                                                        
| 432 | - echo ($response->data->numReportsDeleted ?? 0) . PHP_EOL;  | 
                                                        |
| 431 | + echo ($response->data->numReportsDeleted ?? 0).PHP_EOL;  | 
                                                        |
| 433 | 432 | break;  | 
                                                        
| 434 | 433 | |
| 435 | 434 | }  | 
                                                        
@@ -449,8 +448,8 @@ discard block  | 
                                                    ||
| 449 | 448 |          self::printTitle(Console::text('  ► Get Blacklist ', 'darkgray')); | 
                                                        
| 450 | 449 | |
| 451 | 450 | $plainText = self::$outputFormat === self::OUTPUT_PLAINTEXT;  | 
                                                        
| 452 | - $limit = self::getNumericParameter($arguments,'l', 'limit', 1000);  | 
                                                        |
| 453 | - $scoreMin = self::getNumericParameter($arguments,'s', 'score', 100);  | 
                                                        |
| 451 | + $limit = self::getNumericParameter($arguments, 'l', 'limit', 1000);  | 
                                                        |
| 452 | + $scoreMin = self::getNumericParameter($arguments, 's', 'score', 100);  | 
                                                        |
| 454 | 453 | |
| 455 | 454 | self::printTempMessage();  | 
                                                        
| 456 | 455 | |
@@ -464,13 +463,13 @@ discard block  | 
                                                    ||
| 464 | 463 | |
| 465 | 464 | // response could be json on error, while plaintext flag is set  | 
                                                        
| 466 | 465 | $decodedResponse = $response->getObject();  | 
                                                        
| 467 | -        if (self::printErrors($decodedResponse, false)){ | 
                                                        |
| 466 | +        if (self::printErrors($decodedResponse, false)) { | 
                                                        |
| 468 | 467 | self::printFooter($time);  | 
                                                        
| 469 | 468 | Program::exit(1);  | 
                                                        
| 470 | 469 | }  | 
                                                        
| 471 | 470 | |
| 472 | 471 | // ✓ Done: print deleted report number  | 
                                                        
| 473 | -        switch (self::$outputFormat){ | 
                                                        |
| 472 | +        switch (self::$outputFormat) { | 
                                                        |
| 474 | 473 | case self::OUTPUT_JSON:  | 
                                                        
| 475 | 474 | echo json_encode($response, JSON_PRETTY_PRINT);  | 
                                                        
| 476 | 475 | break;  | 
                                                        
@@ -479,7 +478,7 @@ discard block  | 
                                                    ||
| 479 | 478 | // print list  | 
                                                        
| 480 | 479 |                  self::printResult('  List generated at: ', self::getDate($decodedResponse->meta->generatedAt), 'lightyellow', ''); | 
                                                        
| 481 | 480 | Console::log();  | 
                                                        
| 482 | -                foreach ($decodedResponse->data as $report){ | 
                                                        |
| 481 | +                foreach ($decodedResponse->data as $report) { | 
                                                        |
| 483 | 482 | $score = empty($report->abuseConfidenceScore) ? 0 : $report->abuseConfidenceScore;  | 
                                                        
| 484 | 483 | $defaultColor = self::getScoreColor($score);  | 
                                                        
| 485 | 484 | |
@@ -514,12 +513,12 @@ discard block  | 
                                                    ||
| 514 | 513 | */  | 
                                                        
| 515 | 514 | protected static function checkBlock(array $arguments)  | 
                                                        
| 516 | 515 |      { | 
                                                        
| 517 | - $network = self::getArgumentValue($arguments,'K', 'check-block');  | 
                                                        |
| 516 | + $network = self::getArgumentValue($arguments, 'K', 'check-block');  | 
                                                        |
| 518 | 517 | |
| 519 | -        self::printTitle(Console::text('  ► Check network: ', 'darkgray') . Console::text(escapeshellcmd($network), 'white') . Console::text('', 'darkgray')); | 
                                                        |
| 518 | +        self::printTitle(Console::text('  ► Check network: ', 'darkgray').Console::text(escapeshellcmd($network), 'white').Console::text('', 'darkgray')); | 
                                                        |
| 520 | 519 | |
| 521 | 520 | $maxAge = self::getNumericParameter($arguments, 'd', 'days', 30);  | 
                                                        
| 522 | - $limit = self::getNumericParameter($arguments,'l', 'limit', 0); // 0 mean no limit  | 
                                                        |
| 521 | + $limit = self::getNumericParameter($arguments, 'l', 'limit', 0); // 0 mean no limit  | 
                                                        |
| 523 | 522 | |
| 524 | 523 | self::printTempMessage();  | 
                                                        
| 525 | 524 | |
@@ -530,19 +529,19 @@ discard block  | 
                                                    ||
| 530 | 529 | self::clearTempMessage();  | 
                                                        
| 531 | 530 | |
| 532 | 531 | // check for errors / empty response  | 
                                                        
| 533 | -        if (self::printErrors($check)){ | 
                                                        |
| 532 | +        if (self::printErrors($check)) { | 
                                                        |
| 534 | 533 | self::printFooter($time);  | 
                                                        
| 535 | 534 | Program::exit(1);  | 
                                                        
| 536 | 535 | }  | 
                                                        
| 537 | 536 | |
| 538 | -        switch (self::$outputFormat){ | 
                                                        |
| 537 | +        switch (self::$outputFormat) { | 
                                                        |
| 539 | 538 | case self::OUTPUT_JSON:  | 
                                                        
| 540 | 539 | echo json_encode($check, JSON_PRETTY_PRINT);  | 
                                                        
| 541 | 540 | break;  | 
                                                        
| 542 | 541 | |
| 543 | 542 | case self::OUTPUT_DEFAULT:  | 
                                                        
| 544 | 543 | self::printCheckBlockDetail($check);  | 
                                                        
| 545 | - self::printCheckBlockReportedIP($check,$maxAge,$limit);  | 
                                                        |
| 544 | + self::printCheckBlockReportedIP($check, $maxAge, $limit);  | 
                                                        |
| 546 | 545 | Console::log();  | 
                                                        
| 547 | 546 | self::printFooter($time);  | 
                                                        
| 548 | 547 | break;  | 
                                                        
@@ -551,8 +550,8 @@ discard block  | 
                                                    ||
| 551 | 550 | $nbReports = isset($check->data->reportedAddress) ? count($check->data->reportedAddress) : 0;  | 
                                                        
| 552 | 551 |                  if ($nbReports > 0) { | 
                                                        
| 553 | 552 | $numberDiplayedReports = 0;  | 
                                                        
| 554 | -                    foreach ($check->data->reportedAddress as $report){ | 
                                                        |
| 555 | - echo ($report->ipAddress) . ' ' . $report->abuseConfidenceScore . PHP_EOL;  | 
                                                        |
| 553 | +                    foreach ($check->data->reportedAddress as $report) { | 
                                                        |
| 554 | + echo ($report->ipAddress).' '.$report->abuseConfidenceScore.PHP_EOL;  | 
                                                        |
| 556 | 555 | |
| 557 | 556 | // counter  | 
                                                        
| 558 | 557 | $numberDiplayedReports++;  | 
                                                        
@@ -576,14 +575,14 @@ discard block  | 
                                                    ||
| 576 | 575 | */  | 
                                                        
| 577 | 576 | protected static function checkIP(array $arguments)  | 
                                                        
| 578 | 577 |      { | 
                                                        
| 579 | - $ip = self::getArgumentValue($arguments,'C', 'check');  | 
                                                        |
| 578 | + $ip = self::getArgumentValue($arguments, 'C', 'check');  | 
                                                        |
| 580 | 579 | |
| 581 | -        self::printTitle(Console::text('  ► Check IP: ', 'darkgray') . Console::text(escapeshellcmd($ip), 'white') . Console::text('', 'darkgray')); | 
                                                        |
| 580 | +        self::printTitle(Console::text('  ► Check IP: ', 'darkgray').Console::text(escapeshellcmd($ip), 'white').Console::text('', 'darkgray')); | 
                                                        |
| 582 | 581 | |
| 583 | - $verbose = self::inArguments($arguments,'v', 'verbose');  | 
                                                        |
| 582 | + $verbose = self::inArguments($arguments, 'v', 'verbose');  | 
                                                        |
| 584 | 583 | $maxAge = self::getNumericParameter($arguments, 'd', 'days', 30);  | 
                                                        
| 585 | - $maxReportsNumber = self::getNumericParameter($arguments,'l', 'limit', 10);  | 
                                                        |
| 586 | - $ip = self::getArgumentValue($arguments,'C', 'check');  | 
                                                        |
| 584 | + $maxReportsNumber = self::getNumericParameter($arguments, 'l', 'limit', 10);  | 
                                                        |
| 585 | + $ip = self::getArgumentValue($arguments, 'C', 'check');  | 
                                                        |
| 587 | 586 | |
| 588 | 587 | self::printTempMessage();  | 
                                                        
| 589 | 588 | $timeStart = microtime(true);  | 
                                                        
@@ -593,15 +592,15 @@ discard block  | 
                                                    ||
| 593 | 592 | self::clearTempMessage();  | 
                                                        
| 594 | 593 | |
| 595 | 594 | // check for errors / empty response  | 
                                                        
| 596 | -        if (self::printErrors($check)){ | 
                                                        |
| 595 | +        if (self::printErrors($check)) { | 
                                                        |
| 597 | 596 | self::printFooter($time);  | 
                                                        
| 598 | 597 | Program::exit(1);  | 
                                                        
| 599 | 598 | }  | 
                                                        
| 600 | 599 | |
| 601 | 600 | // score and data color (depending of abuseConfidenceScore)  | 
                                                        
| 602 | - $score = empty($check->data->abuseConfidenceScore) ? 0 : $check->data->abuseConfidenceScore;  | 
                                                        |
| 601 | + $score = empty($check->data->abuseConfidenceScore) ? 0 : $check->data->abuseConfidenceScore;  | 
                                                        |
| 603 | 602 | |
| 604 | -        switch (self::$outputFormat){ | 
                                                        |
| 603 | +        switch (self::$outputFormat) { | 
                                                        |
| 605 | 604 | case self::OUTPUT_JSON:  | 
                                                        
| 606 | 605 | echo json_encode($check, JSON_PRETTY_PRINT);  | 
                                                        
| 607 | 606 | break;  | 
                                                        
@@ -617,7 +616,7 @@ discard block  | 
                                                    ||
| 617 | 616 | break;  | 
                                                        
| 618 | 617 | |
| 619 | 618 | case self::OUTPUT_PLAINTEXT:  | 
                                                        
| 620 | - echo ($check->data->abuseConfidenceScore ?? 0) . PHP_EOL;  | 
                                                        |
| 619 | + echo ($check->data->abuseConfidenceScore ?? 0).PHP_EOL;  | 
                                                        |
| 621 | 620 | break;  | 
                                                        
| 622 | 621 | |
| 623 | 622 | }  | 
                                                        
@@ -38,7 +38,7 @@ discard block  | 
                                                    ||
| 38 | 38 | /**  | 
                                                        
| 39 | 39 | * @var string  | 
                                                        
| 40 | 40 | */  | 
                                                        
| 41 | - const LONG_ARGUMENTS = ['output:','save-key:', 'config', 'list', 'blacklist', 'check:', 'check-block:', 'days:', 'report:', 'categories:', 'message:', 'limit:', 'clear:','bulk-report:', 'help', 'verbose', 'score:','version'];  | 
                                                        |
| 41 | + const LONG_ARGUMENTS = ['output:', 'save-key:', 'config', 'list', 'blacklist', 'check:', 'check-block:', 'days:', 'report:', 'categories:', 'message:', 'limit:', 'clear:', 'bulk-report:', 'help', 'verbose', 'score:', 'version'];  | 
                                                        |
| 42 | 42 | |
| 43 | 43 | /**  | 
                                                        
| 44 | 44 | * @var string  | 
                                                        
@@ -53,29 +53,29 @@ discard block  | 
                                                    ||
| 53 | 53 | /**  | 
                                                        
| 54 | 54 | * @var string  | 
                                                        
| 55 | 55 | */  | 
                                                        
| 56 | - protected static $keyPath = __DIR__ .'/../config/key.json';  | 
                                                        |
| 56 | + protected static $keyPath = __DIR__.'/../config/key.json';  | 
                                                        |
| 57 | 57 | |
| 58 | 58 | /**  | 
                                                        
| 59 | 59 | * @var array  | 
                                                        
| 60 | 60 | */  | 
                                                        
| 61 | 61 | protected static $basicCommands = [  | 
                                                        
| 62 | - ['h', 'help', 'printHelp'],  | 
                                                        |
| 63 | - ['version', 'version', 'printVersion'], // no short arg  | 
                                                        |
| 64 | - ['S', 'save-key', 'registerApiKey'],  | 
                                                        |
| 62 | + ['h', 'help', 'printHelp'],  | 
                                                        |
| 63 | + ['version', 'version', 'printVersion'], // no short arg  | 
                                                        |
| 64 | + ['S', 'save-key', 'registerApiKey'],  | 
                                                        |
| 65 | 65 | ];  | 
                                                        
| 66 | 66 | |
| 67 | 67 | /**  | 
                                                        
| 68 | 68 | * @var array  | 
                                                        
| 69 | 69 | */  | 
                                                        
| 70 | 70 | protected static $mainCommands = [  | 
                                                        
| 71 | - ['G', 'config', 'printConfig'],  | 
                                                        |
| 72 | - ['L', 'list', 'printCategories'],  | 
                                                        |
| 73 | - ['C', 'check', 'checkIP'],  | 
                                                        |
| 74 | - ['K', 'check-block', 'checkBlock'],  | 
                                                        |
| 75 | - ['R', 'report', 'reportIP'],  | 
                                                        |
| 76 | - ['V', 'bulk-report', 'bulkReport'],  | 
                                                        |
| 77 | - ['B', 'blacklist', 'getBlacklist'],  | 
                                                        |
| 78 | - ['E', 'clear', 'clearIP'],  | 
                                                        |
| 71 | + ['G', 'config', 'printConfig'],  | 
                                                        |
| 72 | + ['L', 'list', 'printCategories'],  | 
                                                        |
| 73 | + ['C', 'check', 'checkIP'],  | 
                                                        |
| 74 | + ['K', 'check-block', 'checkBlock'],  | 
                                                        |
| 75 | + ['R', 'report', 'reportIP'],  | 
                                                        |
| 76 | + ['V', 'bulk-report', 'bulkReport'],  | 
                                                        |
| 77 | + ['B', 'blacklist', 'getBlacklist'],  | 
                                                        |
| 78 | + ['E', 'clear', 'clearIP'],  | 
                                                        |
| 79 | 79 | ];  | 
                                                        
| 80 | 80 | |
| 81 | 81 | /**  | 
                                                        
@@ -90,17 +90,17 @@ discard block  | 
                                                    ||
| 90 | 90 | */  | 
                                                        
| 91 | 91 | protected static function parseCommand(array $arguments, string $keyPath)  | 
                                                        
| 92 | 92 |      { | 
                                                        
| 93 | -        foreach( self::$basicCommands as $cmd){ | 
                                                        |
| 94 | -            if (self::inArguments($arguments, $cmd[0], $cmd[1])){ | 
                                                        |
| 95 | - call_user_func(__NAMESPACE__ .'\AbuseIPDBClient::' . $cmd[2], $cmd[2]=== 'registerApiKey' ? $arguments : null);  | 
                                                        |
| 93 | +        foreach (self::$basicCommands as $cmd) { | 
                                                        |
| 94 | +            if (self::inArguments($arguments, $cmd[0], $cmd[1])) { | 
                                                        |
| 95 | + call_user_func(__NAMESPACE__.'\AbuseIPDBClient::'.$cmd[2], $cmd[2] === 'registerApiKey' ? $arguments : null);  | 
                                                        |
| 96 | 96 | return true;  | 
                                                        
| 97 | 97 | }  | 
                                                        
| 98 | 98 | }  | 
                                                        
| 99 | -        foreach( self::$mainCommands as $cmd){ | 
                                                        |
| 100 | -            if (self::inArguments($arguments, $cmd[0], $cmd[1])){ | 
                                                        |
| 99 | +        foreach (self::$mainCommands as $cmd) { | 
                                                        |
| 100 | +            if (self::inArguments($arguments, $cmd[0], $cmd[1])) { | 
                                                        |
| 101 | 101 | self::createHandler($keyPath);  | 
                                                        
| 102 | 102 | self::setOutputFormat($arguments);  | 
                                                        
| 103 | - call_user_func(__NAMESPACE__ .'\AbuseIPDBClient::' . $cmd[2], $arguments);  | 
                                                        |
| 103 | + call_user_func(__NAMESPACE__.'\AbuseIPDBClient::'.$cmd[2], $arguments);  | 
                                                        |
| 104 | 104 | return true;  | 
                                                        
| 105 | 105 | }  | 
                                                        
| 106 | 106 | }  | 
                                                        
@@ -121,8 +121,8 @@ discard block  | 
                                                    ||
| 121 | 121 |      { | 
                                                        
| 122 | 122 | $given = self::getArgumentValue($arguments, 'o', 'output') ?? 'default';  | 
                                                        
| 123 | 123 | $output = empty($given) ? 'default' : $given;  | 
                                                        
| 124 | - self::validate(in_array($output, ['default', 'json', 'plaintext']),'Invalid output argument given.');  | 
                                                        |
| 125 | - self::$outputFormat = $output ;  | 
                                                        |
| 124 | + self::validate(in_array($output, ['default', 'json', 'plaintext']), 'Invalid output argument given.');  | 
                                                        |
| 125 | + self::$outputFormat = $output;  | 
                                                        |
| 126 | 126 | }  | 
                                                        
| 127 | 127 | |
| 128 | 128 | /**  | 
                                                        
@@ -139,7 +139,7 @@ discard block  | 
                                                    ||
| 139 | 139 | protected static function createHandler(string $keyPath)  | 
                                                        
| 140 | 140 |      { | 
                                                        
| 141 | 141 | self::$keyPath = $keyPath;  | 
                                                        
| 142 | - self::validate( self::checkForInstall(), 'Key file missing.');  | 
                                                        |
| 142 | + self::validate(self::checkForInstall(), 'Key file missing.');  | 
                                                        |
| 143 | 143 |          try { | 
                                                        
| 144 | 144 | self::$api = self::fromConfigFile(self::$keyPath);  | 
                                                        
| 145 | 145 |          } catch (\Exception $e) { | 
                                                        
@@ -176,21 +176,21 @@ discard block  | 
                                                    ||
| 176 | 176 | public static function fromConfigFile(string $configPath)  | 
                                                        
| 177 | 177 |      { | 
                                                        
| 178 | 178 | // check file exists  | 
                                                        
| 179 | -        if (!file_exists($configPath) || !is_file($configPath)){ | 
                                                        |
| 180 | -            throw new \InvalidArgumentException('The file [' . $configPath . '] does not exist.'); | 
                                                        |
| 179 | +        if (!file_exists($configPath) || !is_file($configPath)) { | 
                                                        |
| 180 | +            throw new \InvalidArgumentException('The file ['.$configPath.'] does not exist.'); | 
                                                        |
| 181 | 181 | }  | 
                                                        
| 182 | 182 | |
| 183 | 183 | // check file is readable  | 
                                                        
| 184 | -        if (!is_readable($configPath)){ | 
                                                        |
| 185 | -            throw new InvalidPermissionException('The file [' . $configPath . '] is not readable.'); | 
                                                        |
| 184 | +        if (!is_readable($configPath)) { | 
                                                        |
| 185 | +            throw new InvalidPermissionException('The file ['.$configPath.'] is not readable.'); | 
                                                        |
| 186 | 186 | }  | 
                                                        
| 187 | 187 | |
| 188 | 188 | $keyConfig = self::loadJsonFile($configPath);  | 
                                                        
| 189 | 189 | $selfIps = [];  | 
                                                        
| 190 | 190 | |
| 191 | 191 | // Look for other optional config files in the same directory  | 
                                                        
| 192 | - $selfIpsConfigPath = pathinfo($configPath, PATHINFO_DIRNAME) . DIRECTORY_SEPARATOR . 'self_ips.json';  | 
                                                        |
| 193 | -        if (file_exists($selfIpsConfigPath)){ | 
                                                        |
| 192 | + $selfIpsConfigPath = pathinfo($configPath, PATHINFO_DIRNAME).DIRECTORY_SEPARATOR.'self_ips.json';  | 
                                                        |
| 193 | +        if (file_exists($selfIpsConfigPath)) { | 
                                                        |
| 194 | 194 | $selfIps = self::loadJsonFile($selfIpsConfigPath)->self_ips;  | 
                                                        
| 195 | 195 | }  | 
                                                        
| 196 | 196 | |
@@ -41,8 +41,8 @@ discard block  | 
                                                    ||
| 41 | 41 |      { | 
                                                        
| 42 | 42 | // ✓ Done  | 
                                                        
| 43 | 43 | Console::log(  | 
                                                        
| 44 | -            Console::text('   Bulk report for file: [', 'white') . | 
                                                        |
| 45 | - Console::text($fileName, 'lightyellow') .  | 
                                                        |
| 44 | +            Console::text('   Bulk report for file: [', 'white'). | 
                                                        |
| 45 | + Console::text($fileName, 'lightyellow').  | 
                                                        |
| 46 | 46 |              Console::text('] done!', 'white') | 
                                                        
| 47 | 47 | );  | 
                                                        
| 48 | 48 | |
@@ -53,16 +53,16 @@ discard block  | 
                                                    ||
| 53 | 53 | $savedIcon = $nbSavedReports > 0 ? '✓' : '✗';  | 
                                                        
| 54 | 54 | $errorIcon = $nbErrorReports > 0 ? '✗' : '✓';  | 
                                                        
| 55 | 55 | |
| 56 | -        Console::log(Console::text('   ' . $savedIcon, $savedColor) . self::printResult(' Saved reports:    ', $nbSavedReports, $savedColor, '', false)); | 
                                                        |
| 57 | -        Console::log(Console::text('   ' . $errorIcon, $errorColor) . self::printResult(' Invalid reports:  ', $nbErrorReports, $errorColor, '', false)); | 
                                                        |
| 56 | +        Console::log(Console::text('   '.$savedIcon, $savedColor).self::printResult(' Saved reports:    ', $nbSavedReports, $savedColor, '', false)); | 
                                                        |
| 57 | +        Console::log(Console::text('   '.$errorIcon, $errorColor).self::printResult(' Invalid reports:  ', $nbErrorReports, $errorColor, '', false)); | 
                                                        |
| 58 | 58 | |
| 59 | -        if ($nbErrorReports > 0){ | 
                                                        |
| 59 | +        if ($nbErrorReports > 0) { | 
                                                        |
| 60 | 60 | $numberDiplayedReports = 0;  | 
                                                        
| 61 | 61 | $defaultColor = 'lightyellow'; // reset color for last reports  | 
                                                        
| 62 | 62 | |
| 63 | -            foreach ($response->data->invalidReports as $report){ | 
                                                        |
| 63 | +            foreach ($response->data->invalidReports as $report) { | 
                                                        |
| 64 | 64 | $input = $report->input ? escapeshellcmd($report->input) : ''; // in case on blank line, IP is null  | 
                                                        
| 65 | -                Console::log(Console::text('      →', 'red') . self::printResult(' Input:         ', $input, $defaultColor, '', false)); | 
                                                        |
| 65 | +                Console::log(Console::text('      →', 'red').self::printResult(' Input:         ', $input, $defaultColor, '', false)); | 
                                                        |
| 66 | 66 |                  self::printResult('        Error:         ', $report->error, $defaultColor); | 
                                                        
| 67 | 67 |                  self::printResult('        Line number:   ', $report->rowNumber, $defaultColor); | 
                                                        
| 68 | 68 | |
@@ -386,7 +386,7 @@  | 
                                                    ||
| 386 | 386 | */  | 
                                                        
| 387 | 387 | protected static function getNumericParameter(array $arguments, string $shortArg, string $longArg, int $defaultValue)  | 
                                                        
| 388 | 388 |      { | 
                                                        
| 389 | -         if (self::inArguments($arguments,$shortArg, $longArg)){ | 
                                                        |
| 389 | +            if (self::inArguments($arguments,$shortArg, $longArg)){ | 
                                                        |
| 390 | 390 | $val = self::getArgumentValue($arguments,$shortArg, $longArg);  | 
                                                        
| 391 | 391 | |
| 392 | 392 |              if (!is_numeric($val)){ | 
                                                        
@@ -82,7 +82,7 @@ discard block  | 
                                                    ||
| 82 | 82 | protected static function printTempMessage()  | 
                                                        
| 83 | 83 |      { | 
                                                        
| 84 | 84 |          if (self::isDefaultOuput()) { | 
                                                        
| 85 | -            Console::reLog(Console::text('   ? ', 'green') . Console::text('waiting for api response', 'white') . Console::text(' ... ', 'green')); | 
                                                        |
| 85 | +            Console::reLog(Console::text('   ? ', 'green').Console::text('waiting for api response', 'white').Console::text(' ... ', 'green')); | 
                                                        |
| 86 | 86 | }  | 
                                                        
| 87 | 87 | }  | 
                                                        
| 88 | 88 | |
@@ -140,11 +140,11 @@ discard block  | 
                                                    ||
| 140 | 140 | self::printLogo();  | 
                                                        
| 141 | 141 | |
| 142 | 142 | Console::log();  | 
                                                        
| 143 | -        Console::log(Console::text('  Kristuff/AbuseIPDB Client version: ', 'darkgray') . Console::text(AbuseIPDBClient::VERSION, 'lightgray')); | 
                                                        |
| 144 | -        Console::log(Console::text('  Kristuff/AbuseIPDB Core version:   ', 'darkgray') . Console::text(ApiHandler::VERSION, 'lightgray'));  | 
                                                        |
| 143 | +        Console::log(Console::text('  Kristuff/AbuseIPDB Client version: ', 'darkgray').Console::text(AbuseIPDBClient::VERSION, 'lightgray')); | 
                                                        |
| 144 | +        Console::log(Console::text('  Kristuff/AbuseIPDB Core version:   ', 'darkgray').Console::text(ApiHandler::VERSION, 'lightgray'));  | 
                                                        |
| 145 | 145 |          Console::log(Console::text('  --------------------------------------------------', 'darkgray'));     | 
                                                        
| 146 | 146 |          Console::log(Console::text('  Released under the MIT licence', 'darkgray')); | 
                                                        
| 147 | -        Console::log(Console::text('  Made with ', 'darkgray') . Console::text('♥', 'red') . Console::text(' in France', 'darkgray')); | 
                                                        |
| 147 | +        Console::log(Console::text('  Made with ', 'darkgray').Console::text('♥', 'red').Console::text(' in France', 'darkgray')); | 
                                                        |
| 148 | 148 | Console::log(  | 
                                                        
| 149 | 149 |              Console::text('  © 2020-2021 Kristuff (', 'darkgray'). | 
                                                        
| 150 | 150 |              Console::text('https://github.com/kristuff', 'darkgray', 'underlined'). | 
                                                        
@@ -166,8 +166,8 @@ discard block  | 
                                                    ||
| 166 | 166 |      { | 
                                                        
| 167 | 167 |          if (self::isDefaultOuput()) { | 
                                                        
| 168 | 168 | Console::log();  | 
                                                        
| 169 | -            Console::log( Console::text(' Kristuff\AbuseIPDB ', 'darkgray') . Console::text(' ' . AbuseIPDBClient::VERSION . ' ', 'white', 'blue'));  | 
                                                        |
| 170 | -            Console::log(Console::text(' Made with ', 'darkgray') . Console::text('♥', 'red') . Console::text(' in France', 'darkgray'));  | 
                                                        |
| 169 | +            Console::log(Console::text(' Kristuff\AbuseIPDB ', 'darkgray').Console::text(' '.AbuseIPDBClient::VERSION.' ', 'white', 'blue'));  | 
                                                        |
| 170 | +            Console::log(Console::text(' Made with ', 'darkgray').Console::text('♥', 'red').Console::text(' in France', 'darkgray'));  | 
                                                        |
| 171 | 171 |              Console::log(' © 2020-2021 Kristuff', 'darkgray');  | 
                                                        
| 172 | 172 | Console::log();  | 
                                                        
| 173 | 173 | }  | 
                                                        
@@ -184,19 +184,19 @@ discard block  | 
                                                    ||
| 184 | 184 | protected static function printFooter(string $requestTime = '')  | 
                                                        
| 185 | 185 |      { | 
                                                        
| 186 | 186 |          if (self::isDefaultOuput()) { | 
                                                        
| 187 | -            if (!empty($requestTime)){ | 
                                                        |
| 187 | +            if (!empty($requestTime)) { | 
                                                        |
| 188 | 188 |                  $date_utc = new \DateTime("now", new \DateTimeZone("UTC")); | 
                                                        
| 189 | 189 | Console::log(  | 
                                                        
| 190 | -                    Console::text('  Request time: ', 'darkgray') . Console::text($requestTime . 's', 'lightgray').  | 
                                                        |
| 191 | -                    Console::text(' | UTC time: ', 'darkgray') . Console::text($date_utc->format('Y-m-d H:i:s'), 'lightgray') | 
                                                        |
| 190 | +                    Console::text('  Request time: ', 'darkgray').Console::text($requestTime.'s', 'lightgray').  | 
                                                        |
| 191 | +                    Console::text(' | UTC time: ', 'darkgray').Console::text($date_utc->format('Y-m-d H:i:s'), 'lightgray') | 
                                                        |
| 192 | 192 | );  | 
                                                        
| 193 | 193 | }  | 
                                                        
| 194 | 194 |              Console::log(Console::text('  ------------------------------------------------------------------------------------------------------', 'darkgray'));  | 
                                                        
| 195 | 195 | Console::log(  | 
                                                        
| 196 | -                Console::text('  Kristuff\AbuseIPDB ', 'darkgray') .  | 
                                                        |
| 197 | - Console::text(AbuseIPDBClient::VERSION, 'lightgray') .  | 
                                                        |
| 198 | -                Console::text(' | Made with ', 'darkgray') .  | 
                                                        |
| 199 | -                Console::text('♥', 'red') . | 
                                                        |
| 196 | +                Console::text('  Kristuff\AbuseIPDB ', 'darkgray').  | 
                                                        |
| 197 | + Console::text(AbuseIPDBClient::VERSION, 'lightgray').  | 
                                                        |
| 198 | +                Console::text(' | Made with ', 'darkgray').  | 
                                                        |
| 199 | +                Console::text('♥', 'red'). | 
                                                        |
| 200 | 200 |                  Console::text(' in France | © 2020-2021 Kristuff (https://github.com/kristuff)', 'darkgray') | 
                                                        
| 201 | 201 | );  | 
                                                        
| 202 | 202 | Console::log();  | 
                                                        
@@ -215,9 +215,9 @@ discard block  | 
                                                    ||
| 215 | 215 |      { | 
                                                        
| 216 | 216 | |
| 217 | 217 | // do not print null/blank values  | 
                                                        
| 218 | -        if (isset($value)){ | 
                                                        |
| 219 | - $line = Console::text($text, 'white') . Console::text($value, $foregroundColor, $backgroundColor);  | 
                                                        |
| 220 | -            if ($print && self::isDefaultOuput()){ | 
                                                        |
| 218 | +        if (isset($value)) { | 
                                                        |
| 219 | + $line = Console::text($text, 'white').Console::text($value, $foregroundColor, $backgroundColor);  | 
                                                        |
| 220 | +            if ($print && self::isDefaultOuput()) { | 
                                                        |
| 221 | 221 | Console::log($line);  | 
                                                        
| 222 | 222 | }  | 
                                                        
| 223 | 223 | return $line;  | 
                                                        
@@ -241,16 +241,16 @@ discard block  | 
                                                    ||
| 241 | 241 | $scoreforegroundColor = 'white';  | 
                                                        
| 242 | 242 | $scoreBackgroundColor = 'green';  | 
                                                        
| 243 | 243 | |
| 244 | -        if (intval($score) > 0 ){ | 
                                                        |
| 244 | +        if (intval($score) > 0) { | 
                                                        |
| 245 | 245 | $scoreforegroundColor = 'black';  | 
                                                        
| 246 | 246 | $scoreBackgroundColor = 'yellow';  | 
                                                        
| 247 | 247 | }  | 
                                                        
| 248 | -        if (intval($score) > 50 ){ | 
                                                        |
| 248 | +        if (intval($score) > 50) { | 
                                                        |
| 249 | 249 | $scoreforegroundColor = 'white';  | 
                                                        
| 250 | 250 | $scoreBackgroundColor = 'red';  | 
                                                        
| 251 | 251 | }  | 
                                                        
| 252 | 252 | |
| 253 | - $badge = str_pad($score, 3, ' ',STR_PAD_LEFT);  | 
                                                        |
| 253 | + $badge = str_pad($score, 3, ' ', STR_PAD_LEFT);  | 
                                                        |
| 254 | 254 | return Console::text($padding.$badge.$padding, $scoreforegroundColor, $scoreBackgroundColor);  | 
                                                        
| 255 | 255 | }  | 
                                                        
| 256 | 256 | |
@@ -266,29 +266,29 @@ discard block  | 
                                                    ||
| 266 | 266 | */  | 
                                                        
| 267 | 267 | protected static function printErrors($response, bool $checkForEmpty = true)  | 
                                                        
| 268 | 268 |      { | 
                                                        
| 269 | -        if (isset($response) && isset($response->errors)){ | 
                                                        |
| 269 | +        if (isset($response) && isset($response->errors)) { | 
                                                        |
| 270 | 270 | |
| 271 | -            switch (self::$outputFormat){ | 
                                                        |
| 271 | +            switch (self::$outputFormat) { | 
                                                        |
| 272 | 272 | case self::OUTPUT_DEFAULT:  | 
                                                        
| 273 | 273 | // top error badge  | 
                                                        
| 274 | -                    Console::log('  ' .   Console::text(' ERROR ','white', 'red')); | 
                                                        |
| 274 | +                    Console::log('  '.Console::text(' ERROR ', 'white', 'red')); | 
                                                        |
| 275 | 275 | |
| 276 | 276 | $num = 0;  | 
                                                        
| 277 | 277 | // errors is an array, could have more than one error..  | 
                                                        
| 278 | -                    foreach ($response->errors as $err){ | 
                                                        |
| 278 | +                    foreach ($response->errors as $err) { | 
                                                        |
| 279 | 279 | $num++;  | 
                                                        
| 280 | 280 | |
| 281 | -                        Console::log(Console::text('   ✗', 'red') .  self::printResult(' Number:    ', $num, 'lightyellow','', false)); | 
                                                        |
| 282 | -                        self::printResult('     Status:    ', $err->status ?? null, 'lightyellow','');     | 
                                                        |
| 281 | +                        Console::log(Console::text('   ✗', 'red').self::printResult(' Number:    ', $num, 'lightyellow', '', false)); | 
                                                        |
| 282 | +                        self::printResult('     Status:    ', $err->status ?? null, 'lightyellow', '');     | 
                                                        |
| 283 | 283 | |
| 284 | -                        if (!empty($err->source) && !empty($err->source->parameter)){ | 
                                                        |
| 284 | +                        if (!empty($err->source) && !empty($err->source->parameter)) { | 
                                                        |
| 285 | 285 |                              self::printResult('     Parameter: ', $err->source->parameter, 'lightyellow');     | 
                                                        
| 286 | 286 | }  | 
                                                        
| 287 | 287 |                          self::printResult('     Title:     ', $err->title ?? null, 'lightyellow');     | 
                                                        
| 288 | 288 |                          self::printResult('     Detail:    ', $err->detail ?? null, 'lightyellow');     | 
                                                        
| 289 | 289 | |
| 290 | 290 | // separate errors  | 
                                                        
| 291 | -                        if (count($response->errors) > 1){ | 
                                                        |
| 291 | +                        if (count($response->errors) > 1) { | 
                                                        |
| 292 | 292 |                              Console::log('   ---'); | 
                                                        
| 293 | 293 | }  | 
                                                        
| 294 | 294 | |
@@ -297,12 +297,12 @@ discard block  | 
                                                    ||
| 297 | 297 | break;  | 
                                                        
| 298 | 298 | |
| 299 | 299 | case self::OUTPUT_PLAINTEXT:  | 
                                                        
| 300 | -                    foreach ($response->errors as $err){ | 
                                                        |
| 300 | +                    foreach ($response->errors as $err) { | 
                                                        |
| 301 | 301 | $text = 'Error: ';  | 
                                                        
| 302 | - $text .= !empty($err->title) ? ' title: ' . $err->title : '';  | 
                                                        |
| 303 | - $text .= !empty($err->status) ? ' status: ' . $err->status : '';  | 
                                                        |
| 304 | - $text .= !empty($err->source) && !empty($err->source->parameter) ? ' parameter: ' . $err->source->parameter : '';  | 
                                                        |
| 305 | - $text .= !empty($err->detail) ? ' detail: ' . $err->detail : '';  | 
                                                        |
| 302 | + $text .= !empty($err->title) ? ' title: '.$err->title : '';  | 
                                                        |
| 303 | + $text .= !empty($err->status) ? ' status: '.$err->status : '';  | 
                                                        |
| 304 | + $text .= !empty($err->source) && !empty($err->source->parameter) ? ' parameter: '.$err->source->parameter : '';  | 
                                                        |
| 305 | + $text .= !empty($err->detail) ? ' detail: '.$err->detail : '';  | 
                                                        |
| 306 | 306 | $text .= PHP_EOL;  | 
                                                        
| 307 | 307 | echo $text;  | 
                                                        
| 308 | 308 | }  | 
                                                        
@@ -317,7 +317,7 @@ discard block  | 
                                                    ||
| 317 | 317 | }  | 
                                                        
| 318 | 318 | |
| 319 | 319 | // check for empty response ?  | 
                                                        
| 320 | -        if ( $checkForEmpty && ( empty($response) || empty($response->data)) ){ | 
                                                        |
| 320 | +        if ($checkForEmpty && (empty($response) || empty($response->data))) { | 
                                                        |
| 321 | 321 |              self::error('An unexpected error occurred.'); | 
                                                        
| 322 | 322 | return true;  | 
                                                        
| 323 | 323 | }  | 
                                                        
@@ -338,11 +338,11 @@ discard block  | 
                                                    ||
| 338 | 338 |      { | 
                                                        
| 339 | 339 |          if (self::isDefaultOuput()) { | 
                                                        
| 340 | 340 | // ✗  | 
                                                        
| 341 | -            Console::log('  ' .   Console::text(' ERROR ','white', 'red')); | 
                                                        |
| 341 | +            Console::log('  '.Console::text(' ERROR ', 'white', 'red')); | 
                                                        |
| 342 | 342 | Console::log(  | 
                                                        
| 343 | -                Console::text('   ✗', 'red') .  | 
                                                        |
| 344 | -                Console::text(' Detail:    ', 'white') .  | 
                                                        |
| 345 | - Console::text($error, 'lightyellow') .  | 
                                                        |
| 343 | +                Console::text('   ✗', 'red').  | 
                                                        |
| 344 | +                Console::text(' Detail:    ', 'white').  | 
                                                        |
| 345 | + Console::text($error, 'lightyellow').  | 
                                                        |
| 346 | 346 |                  Console::text('', 'white') | 
                                                        
| 347 | 347 | );  | 
                                                        
| 348 | 348 | Console::log();  | 
                                                        
@@ -362,7 +362,7 @@ discard block  | 
                                                    ||
| 362 | 362 | */  | 
                                                        
| 363 | 363 | protected static function validate(bool $condition, string $message, bool $print = true)  | 
                                                        
| 364 | 364 |      { | 
                                                        
| 365 | -        if ( !$condition ){ | 
                                                        |
| 365 | +        if (!$condition) { | 
                                                        |
| 366 | 366 |              if ($print && self::isDefaultOuput()) { | 
                                                        
| 367 | 367 | Console::log();  | 
                                                        
| 368 | 368 | self::error($message);  | 
                                                        
@@ -386,10 +386,10 @@ discard block  | 
                                                    ||
| 386 | 386 | */  | 
                                                        
| 387 | 387 | protected static function getNumericParameter(array $arguments, string $shortArg, string $longArg, int $defaultValue)  | 
                                                        
| 388 | 388 |      { | 
                                                        
| 389 | -         if (self::inArguments($arguments,$shortArg, $longArg)){ | 
                                                        |
| 390 | - $val = self::getArgumentValue($arguments,$shortArg, $longArg);  | 
                                                        |
| 389 | +         if (self::inArguments($arguments, $shortArg, $longArg)) { | 
                                                        |
| 390 | + $val = self::getArgumentValue($arguments, $shortArg, $longArg);  | 
                                                        |
| 391 | 391 | |
| 392 | -            if (!is_numeric($val)){ | 
                                                        |
| 392 | +            if (!is_numeric($val)) { | 
                                                        |
| 393 | 393 |                  self::error("Invalid parameter: $longArg must be a numeric value."); | 
                                                        
| 394 | 394 | self::printFooter();  | 
                                                        
| 395 | 395 | Program::exit(1);  | 
                                                        
@@ -65,13 +65,13 @@ discard block  | 
                                                    ||
| 65 | 65 |              self::printResult(Console::pad('   Reported addresses:', 23), $nbReports, 'lightyellow'); | 
                                                        
| 66 | 66 | $numberDiplayedReports = 0;  | 
                                                        
| 67 | 67 | |
| 68 | -            foreach ($response->data->reportedAddress as $report){ | 
                                                        |
| 68 | +            foreach ($response->data->reportedAddress as $report) { | 
                                                        |
| 69 | 69 | $score = empty($report->abuseConfidenceScore) ? 0 : $report->abuseConfidenceScore;  | 
                                                        
| 70 | 70 | $defaultColor = self::getScoreColor($score); // color based on score  | 
                                                        
| 71 | 71 | |
| 72 | 72 |                  $line  = Console::text('   →', $defaultColor); | 
                                                        
| 73 | 73 |                  $line .= self::printResult(' IP: ', $report->ipAddress, $defaultColor, '', false); | 
                                                        
| 74 | -                $line .= self::printResult(' Country: ', $report->countryCode , $defaultColor, '', false); | 
                                                        |
| 74 | +                $line .= self::printResult(' Country: ', $report->countryCode, $defaultColor, '', false); | 
                                                        |
| 75 | 75 |                  $line .= Console::text(' | Confidence score: ', 'white'); | 
                                                        
| 76 | 76 | $line .= self::getScoreBadge($score);  | 
                                                        
| 77 | 77 |                  $line .= self::printResult(' Total reports: ', $report->numReports, $defaultColor, '', false); | 
                                                        
@@ -86,7 +86,7 @@ discard block  | 
                                                    ||
| 86 | 86 | $line .= Console::text($numberDiplayedReports, 'lightyellow');  | 
                                                        
| 87 | 87 |                      $line .= Console::text('/', 'white'); | 
                                                        
| 88 | 88 | $line .= Console::text($nbReports, 'lightyellow');  | 
                                                        
| 89 | - $line .= Console::text($numberDiplayedReports > 1 ? ' IPs displayed)': ' IP displayed)', 'white');  | 
                                                        |
| 89 | + $line .= Console::text($numberDiplayedReports > 1 ? ' IPs displayed)' : ' IP displayed)', 'white');  | 
                                                        |
| 90 | 90 | Console::log($line);  | 
                                                        
| 91 | 91 | break;  | 
                                                        
| 92 | 92 | }  | 
                                                        
@@ -94,8 +94,8 @@ discard block  | 
                                                    ||
| 94 | 94 | |
| 95 | 95 |          } else { | 
                                                        
| 96 | 96 | // no reports  | 
                                                        
| 97 | - $day = $maxAge > 1 ? 'in last '. $maxAge . ' days': ' today';  | 
                                                        |
| 98 | -            Console::log( Console::text('    ✓', 'green') . Console::text(' No IP reported ' . $day)); | 
                                                        |
| 97 | + $day = $maxAge > 1 ? 'in last '.$maxAge.' days' : ' today';  | 
                                                        |
| 98 | +            Console::log(Console::text('    ✓', 'green').Console::text(' No IP reported '.$day)); | 
                                                        |
| 99 | 99 | }  | 
                                                        
| 100 | 100 | }  | 
                                                        
| 101 | 101 | }  | 
                                                        
| 102 | 102 | \ No newline at end of file  | 
                                                        
@@ -131,8 +131,8 @@ discard block  | 
                                                    ||
| 131 | 131 | */  | 
                                                        
| 132 | 132 | protected static function printCheckLastReports(object $response, bool $verbose, int $maxReportsNumber)  | 
                                                        
| 133 | 133 |      { | 
                                                        
| 134 | - // print last reports  | 
                                                        |
| 135 | -         if ($verbose){ | 
                                                        |
| 134 | + // print last reports  | 
                                                        |
| 135 | +            if ($verbose){ | 
                                                        |
| 136 | 136 | $nbLastReports = isset($response->data->reports) ? count($response->data->reports) : 0;  | 
                                                        
| 137 | 137 | |
| 138 | 138 |              if ($nbLastReports > 0){ | 
                                                        
@@ -151,7 +151,7 @@ discard block  | 
                                                    ||
| 151 | 151 | |
| 152 | 152 |                      $line  = Console::text('    →', $defaultColor); | 
                                                        
| 153 | 153 |                      $line .= self::printResult(' reported at: ', self::getDate($lastReport->reportedAt), $defaultColor, '', false); | 
                                                        
| 154 | -              //    $line .= self::printResult(' by user: ', $lastReport->reporterId, $defaultColor, '', false); | 
                                                        |
| 154 | +                //    $line .= self::printResult(' by user: ', $lastReport->reporterId, $defaultColor, '', false); | 
                                                        |
| 155 | 155 |                      if (isset($lastReport->reporterCountryCode) && isset($lastReport->reporterCountryName)){ | 
                                                        
| 156 | 156 |                          $line .= Console::text(' from: ', 'white'); | 
                                                        
| 157 | 157 |                          $line .= self::printResult('', $lastReport->reporterCountryCode, $defaultColor, '', false); | 
                                                        
@@ -41,7 +41,7 @@ discard block  | 
                                                    ||
| 41 | 41 | protected static function printCheckScore(object $response)  | 
                                                        
| 42 | 42 |      { | 
                                                        
| 43 | 43 | $score = empty($response->data->abuseConfidenceScore) ? 0 : $response->data->abuseConfidenceScore;  | 
                                                        
| 44 | -        $line = Console::text(Console::pad('   Confidence score:', 23), 'white') . self::getScoreBadge($score); | 
                                                        |
| 44 | +        $line = Console::text(Console::pad('   Confidence score:', 23), 'white').self::getScoreBadge($score); | 
                                                        |
| 45 | 45 | Console::log($line);  | 
                                                        
| 46 | 46 | }  | 
                                                        
| 47 | 47 | |
@@ -60,26 +60,26 @@ discard block  | 
                                                    ||
| 60 | 60 |          //      self::printResult('   isPublic', $response->data->isPublic, $defaultColor); | 
                                                        
| 61 | 61 |          //      self::printResult('   ipVersion', $response->data->ipVersion, $defaultColor); | 
                                                        
| 62 | 62 | |
| 63 | -        $line = self::printResult(Console::pad('   Whitelisted:', 23), $response->data->isWhitelisted ? 'true': 'false', $color, '', false); | 
                                                        |
| 63 | +        $line = self::printResult(Console::pad('   Whitelisted:', 23), $response->data->isWhitelisted ? 'true' : 'false', $color, '', false); | 
                                                        |
| 64 | 64 |          $line .= $response->data->isWhitelisted ? Console::text(' ★', 'green') : '';  | 
                                                        
| 65 | 65 | Console::log($line);  | 
                                                        
| 66 | 66 | |
| 67 | 67 |          self::printResult(Console::pad('   Country code:', 23), $response->data->countryCode, $color); | 
                                                        
| 68 | 68 | |
| 69 | -        if (!empty($response->data->countryName)){ | 
                                                        |
| 69 | +        if (!empty($response->data->countryName)) { | 
                                                        |
| 70 | 70 |              self::printResult(Console::pad('   Country name:', 23), $response->data->countryName, $color); | 
                                                        
| 71 | 71 | }  | 
                                                        
| 72 | 72 | |
| 73 | 73 |          self::printResult(Console::pad('   ISP:', 23), $response->data->isp, $color); | 
                                                        
| 74 | 74 | |
| 75 | -        if ($response->data->usageType){ | 
                                                        |
| 75 | +        if ($response->data->usageType) { | 
                                                        |
| 76 | 76 |              $line = self::printResult(Console::pad('   Usage type:', 23), $response->data->usageType, $color, '', false); | 
                                                        
| 77 | 77 |              $line .= $response->data->usageType === 'Reserved' ? Console::text(' ◆', 'green') : ''; | 
                                                        
| 78 | 78 | Console::log($line);  | 
                                                        
| 79 | 79 | }  | 
                                                        
| 80 | 80 | |
| 81 | 81 |          $hostames = implode(', ', array_filter($response->data->hostnames)) ?? null; | 
                                                        
| 82 | -        if (!empty($hostames)){ | 
                                                        |
| 82 | +        if (!empty($hostames)) { | 
                                                        |
| 83 | 83 |              self::printResult(Console::pad('   Hostname(s):', 23), $hostames, $color); | 
                                                        
| 84 | 84 | }  | 
                                                        
| 85 | 85 | |
@@ -101,19 +101,19 @@ discard block  | 
                                                    ||
| 101 | 101 |      { | 
                                                        
| 102 | 102 | $nbReport = $response->data->totalReports && is_numeric($response->data->totalReports) ? intval($response->data->totalReports) : 0;  | 
                                                        
| 103 | 103 | |
| 104 | -        if ($nbReport > 0 ){ | 
                                                        |
| 104 | +        if ($nbReport > 0) { | 
                                                        |
| 105 | 105 |              $line  = self::printResult(Console::pad('   Total reports:', 23), $nbReport, $color, '', false); | 
                                                        
| 106 | 106 |              $line .= self::printResult(' from ', $response->data->numDistinctUsers, $color, '', false); | 
                                                        
| 107 | - $line .= Console::text($nbReport > 0 ? ' distinct users': ' user', 'white');  | 
                                                        |
| 107 | + $line .= Console::text($nbReport > 0 ? ' distinct users' : ' user', 'white');  | 
                                                        |
| 108 | 108 | Console::log($line);  | 
                                                        
| 109 | 109 | |
| 110 | 110 |          } else { | 
                                                        
| 111 | 111 | // no reports  | 
                                                        
| 112 | - $day = $maxAge > 1 ? 'in last '. $maxAge . ' days': ' today';  | 
                                                        |
| 113 | -            Console::log( Console::text('   ✓', 'green') . Console::text(' Not reported ' . $day)); | 
                                                        |
| 112 | + $day = $maxAge > 1 ? 'in last '.$maxAge.' days' : ' today';  | 
                                                        |
| 113 | +            Console::log(Console::text('   ✓', 'green').Console::text(' Not reported '.$day)); | 
                                                        |
| 114 | 114 | }  | 
                                                        
| 115 | 115 | |
| 116 | -        if (!empty($response->data->lastReportedAt)){ | 
                                                        |
| 116 | +        if (!empty($response->data->lastReportedAt)) { | 
                                                        |
| 117 | 117 |              self::printResult(Console::pad('   Last reported at:', 23), self::getDate($response->data->lastReportedAt), $color); | 
                                                        
| 118 | 118 | }  | 
                                                        
| 119 | 119 | }  | 
                                                        
@@ -132,17 +132,17 @@ discard block  | 
                                                    ||
| 132 | 132 | protected static function printCheckLastReports(object $response, bool $verbose, int $maxReportsNumber)  | 
                                                        
| 133 | 133 |      { | 
                                                        
| 134 | 134 | // print last reports  | 
                                                        
| 135 | -         if ($verbose){ | 
                                                        |
| 135 | +         if ($verbose) { | 
                                                        |
| 136 | 136 | $nbLastReports = isset($response->data->reports) ? count($response->data->reports) : 0;  | 
                                                        
| 137 | 137 | |
| 138 | -            if ($nbLastReports > 0){ | 
                                                        |
| 138 | +            if ($nbLastReports > 0) { | 
                                                        |
| 139 | 139 |                  Console::log('   Last reports:', 'white'); | 
                                                        
| 140 | 140 | $numberDiplayedReports = 0;  | 
                                                        
| 141 | 141 | $defaultColor = 'lightyellow'; // reset color for last reports  | 
                                                        
| 142 | 142 | |
| 143 | -                foreach ($response->data->reports as $lastReport){ | 
                                                        |
| 143 | +                foreach ($response->data->reports as $lastReport) { | 
                                                        |
| 144 | 144 | $categories = [];  | 
                                                        
| 145 | -                    foreach (array_filter($lastReport->categories) as $catId){ | 
                                                        |
| 145 | +                    foreach (array_filter($lastReport->categories) as $catId) { | 
                                                        |
| 146 | 146 | $cat = ApiHandler::getCategoryNamebyId($catId)[0];  | 
                                                        
| 147 | 147 |                          if ($cat !== false) { | 
                                                        
| 148 | 148 | $categories[] = $cat;  | 
                                                        
@@ -152,15 +152,15 @@ discard block  | 
                                                    ||
| 152 | 152 |                      $line  = Console::text('    →', $defaultColor); | 
                                                        
| 153 | 153 |                      $line .= self::printResult(' reported at: ', self::getDate($lastReport->reportedAt), $defaultColor, '', false); | 
                                                        
| 154 | 154 |                //    $line .= self::printResult(' by user: ', $lastReport->reporterId, $defaultColor, '', false); | 
                                                        
| 155 | -                    if (isset($lastReport->reporterCountryCode) && isset($lastReport->reporterCountryName)){ | 
                                                        |
| 155 | +                    if (isset($lastReport->reporterCountryCode) && isset($lastReport->reporterCountryName)) { | 
                                                        |
| 156 | 156 |                          $line .= Console::text(' from: ', 'white'); | 
                                                        
| 157 | 157 |                          $line .= self::printResult('', $lastReport->reporterCountryCode, $defaultColor, '', false); | 
                                                        
| 158 | 158 |                          $line .= Console::text(' - ', 'white'); | 
                                                        
| 159 | 159 |                          $line .= self::printResult('', $lastReport->reporterCountryName, $defaultColor, '', false); | 
                                                        
| 160 | 160 | }  | 
                                                        
| 161 | -                    $line .= Console::text(' with categor' .  (count($categories) > 1 ? "ies: " : "y: "), 'white'); | 
                                                        |
| 161 | +                    $line .= Console::text(' with categor'.(count($categories) > 1 ? "ies: " : "y: "), 'white'); | 
                                                        |
| 162 | 162 |                      foreach ($categories as $key => $cat) { | 
                                                        
| 163 | - $line .= Console::text($key==0 ? '' : ',' , 'white') . Console::text($cat, $defaultColor);  | 
                                                        |
| 163 | + $line .= Console::text($key == 0 ? '' : ',', 'white').Console::text($cat, $defaultColor);  | 
                                                        |
| 164 | 164 | }  | 
                                                        
| 165 | 165 | Console::log($line);  | 
                                                        
| 166 | 166 | |
@@ -171,7 +171,7 @@ discard block  | 
                                                    ||
| 171 | 171 | $line .= Console::text($numberDiplayedReports, $defaultColor);  | 
                                                        
| 172 | 172 |                          $line .= Console::text('/', 'white'); | 
                                                        
| 173 | 173 | $line .= Console::text($nbLastReports, $defaultColor);  | 
                                                        
| 174 | - $line .= Console::text($numberDiplayedReports > 1 ? ' reports displayed)': ' report displayed)', 'white');  | 
                                                        |
| 174 | + $line .= Console::text($numberDiplayedReports > 1 ? ' reports displayed)' : ' report displayed)', 'white');  | 
                                                        |
| 175 | 175 | Console::log($line);  | 
                                                        
| 176 | 176 | break;  | 
                                                        
| 177 | 177 | }  |