| @@ -6,12 +6,11 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace WP_Defender\Traits; |
| 9 | 9 | |
| 10 | -use DI\NotFoundException; | |
| 11 | -use DI\DependencyException; | |
| 10 | +use RuntimeException; | |
| 12 | 11 | use WP_Defender\Extra\GeoIp; |
| 13 | -use MaxMind\Db\Reader\InvalidDatabaseException; | |
| 12 | +use WP_DEFENDER_VENDOR\MaxMind\Db\Reader\InvalidDatabaseException; | |
| 14 | 13 | use WP_Defender\Model\Setting\Blacklist_Lockout; |
| 15 | 14 | |
| 16 | 15 | trait Country { |
| 17 | 16 | |
| @@ -20,10 +19,9 @@ | ||
| 20 | 19 | * |
| 21 | 20 | * @param string $ip IPV4 or IPV6 address. |
| 22 | 21 | * |
| 23 | 22 | * @return array|bool |
| 24 | - * @throws DependencyException Container exception. | |
| 25 | - * @throws NotFoundException Thrown when DI injected class not found. | |
| 23 | + * @throws RuntimeException Thrown when a dependency cannot be resolved. | |
| 26 | 24 | * @throws InvalidDatabaseException Thrown for unexpected data is found in DB. |
| 27 | 25 | */ |
| 28 | 26 | public function get_current_country( $ip ) { |
| 29 | 27 | if ( defender_is_wp_cli() ) { |
| @@ -38,9 +36,9 @@ | ||
| 38 | 36 | return false; |
| 39 | 37 | } |
| 40 | 38 | $model = wd_di()->get( Blacklist_Lockout::class ); |
| 41 | 39 | // Additional check if MaxMind dir is deleted. |
| 42 | - if ( is_null( $model->geodb_path ) || ! is_file( $model->geodb_path ) ) { | |
| 40 | + if ( ! is_string( $model->geodb_path ) || ! is_file( $model->geodb_path ) ) { | |
| 43 | 41 | return false; |
| 44 | 42 | } |
| 45 | 43 | $helper = new GeoIp( $model->geodb_path ); |
| 46 | 44 | |