@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | abstract class ApiDefintion |
| 30 | 30 | { |
| 31 | - /** |
|
| 32 | - * AbuseIPDB API v2 Endpoint |
|
| 33 | - * @var string $api_endpoint |
|
| 34 | - */ |
|
| 31 | + /** |
|
| 32 | + * AbuseIPDB API v2 Endpoint |
|
| 33 | + * @var string $api_endpoint |
|
| 34 | + */ |
|
| 35 | 35 | protected $aipdbApiEndpoint = 'https://api.abuseipdb.com/api/v2/'; |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | // Open proxy, open relay, or Tor exit node. |
| 68 | 68 | ['openproxy' , '9', 'Open Proxy', true], |
| 69 | 69 | |
| 70 | - // Comment/forum spam, HTTP referer spam, or other CMS spam. |
|
| 71 | - ['webspam' , '10', 'Web Spam', true], |
|
| 70 | + // Comment/forum spam, HTTP referer spam, or other CMS spam. |
|
| 71 | + ['webspam' , '10', 'Web Spam', true], |
|
| 72 | 72 | |
| 73 | 73 | // Spam email content, infected attachments, and phishing emails. Note: Limit comments to only relevent |
| 74 | 74 | // information (instead of log dumps) and be sure to remove PII if you want to remain anonymous. |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | // Abuse was targeted at an "Internet of Things" type device. Include |
| 118 | 118 | // information about what type of device was targeted in the comments. |
| 119 | 119 | ['oit' , '23', 'IoT Targeted', true], |
| 120 | - ]; |
|
| 120 | + ]; |
|
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | 123 | * Get the category id corresponding to given name |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | if ($cat[0] === $categoryName) { |
| 134 | 134 | return $cat; |
| 135 | 135 | } |
| 136 | - } |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | 138 | // not found |
| 139 | 139 | return false; |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | public function getCategoryNameById(string $categoryId) |
| 151 | 151 | { |
| 152 | 152 | foreach ($this->aipdbApiCategories as $cat){ |
| 153 | - if ($cat[1] === $categoryId) { |
|
| 154 | - return $cat; |
|
| 155 | - } |
|
| 153 | + if ($cat[1] === $categoryId) { |
|
| 154 | + return $cat; |
|
| 155 | + } |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // not found |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | return $i; |
| 177 | 177 | } |
| 178 | 178 | $i++; |
| 179 | - } |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | 181 | // not found |
| 182 | 182 | return false; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function report(string $ip = '', string $categories = '', string $message = '', bool $returnArray = false) |
| 159 | 159 | { |
| 160 | - // ip must be set |
|
| 160 | + // ip must be set |
|
| 161 | 161 | if (empty($ip)){ |
| 162 | 162 | throw new \InvalidArgumentException('Ip was empty'); |
| 163 | 163 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | // message must be set |
| 171 | - if (empty($message)){ |
|
| 171 | + if (empty($message)){ |
|
| 172 | 172 | throw new \InvalidArgumentException('report message was empty'); |
| 173 | 173 | } |
| 174 | 174 | |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | // option |
| 287 | 287 | if ($verbose){ |
| 288 | - $data['verbose'] = true; |
|
| 288 | + $data['verbose'] = true; |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | // check AbuseIPDB request |
@@ -331,14 +331,14 @@ discard block |
||
| 331 | 331 | 'Key: ' . $this->aipdbApiKey, |
| 332 | 332 | ]); |
| 333 | 333 | |
| 334 | - // execute curl call |
|
| 335 | - $result = curl_exec($ch); |
|
| 334 | + // execute curl call |
|
| 335 | + $result = curl_exec($ch); |
|
| 336 | 336 | |
| 337 | - // close connection |
|
| 338 | - curl_close($ch); |
|
| 337 | + // close connection |
|
| 338 | + curl_close($ch); |
|
| 339 | 339 | |
| 340 | - // return response as object / array |
|
| 341 | - return json_decode($result, $returnArray); |
|
| 340 | + // return response as object / array |
|
| 341 | + return json_decode($result, $returnArray); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | * @access public |
| 349 | 349 | * @param string $message The original message |
| 350 | 350 | * |
| 351 | - * @return string |
|
| 351 | + * @return string |
|
| 352 | 352 | */ |
| 353 | 353 | protected function cleanMessage(string $message) |
| 354 | 354 | { |
@@ -373,10 +373,10 @@ discard block |
||
| 373 | 373 | * |
| 374 | 374 | * @access public |
| 375 | 375 | * @static |
| 376 | - * @param string $filePath The file's full path |
|
| 377 | - * @param bool $trowError Throw error on true or silent process. Default is true |
|
| 376 | + * @param string $filePath The file's full path |
|
| 377 | + * @param bool $trowError Throw error on true or silent process. Default is true |
|
| 378 | 378 | * |
| 379 | - * @return object|null |
|
| 379 | + * @return object|null |
|
| 380 | 380 | * @throws \Exception |
| 381 | 381 | * @throws \LogicException |
| 382 | 382 | */ |
@@ -384,10 +384,10 @@ discard block |
||
| 384 | 384 | { |
| 385 | 385 | // check file exists |
| 386 | 386 | if (!file_exists($filePath) || !is_file($filePath)){ |
| 387 | - if ($throwError) { |
|
| 387 | + if ($throwError) { |
|
| 388 | 388 | throw new \Exception('Config file not found'); |
| 389 | - } |
|
| 390 | - return null; |
|
| 389 | + } |
|
| 390 | + return null; |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | // get and parse content |