IP::sendRequest()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of Esi\IPQuery.
7
 *
8
 * (c) Eric Sizemore <[email protected]>
9
 *
10
 * This source file is subject to the MIT license. For the full copyright and
11
 * license information, please view the LICENSE file that was distributed with
12
 * this source code.
13
 */
14
15
namespace Esi\IPQuery\Api;
16
17
use Http\Client\Exception;
18
19
class IP extends AbstractApi
0 ignored issues
show
Bug introduced by
The type Esi\IPQuery\Api\AbstractApi was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
{
21
    /**
22
     * Get information about one or more IP addresses.
23
     *
24
     * @param array<string>|string $ip     One or more IP addresses (comma-separated)
25
     * @param 'json'|'xml'|'yaml'  $format Response format (default: json)
0 ignored issues
show
Documentation Bug introduced by
The doc comment 'json'|'xml'|'yaml' at position 0 could not be parsed: Unknown type name ''json'' at position 0 in 'json'|'xml'|'yaml'.
Loading history...
26
     *
27
     * @throws Exception
28
     */
29 5
    public function sendRequest(array|string $ip, string $format = 'json'): string
30
    {
31 5
        $response = $this->get($ip, $format);
32
33 2
        return (string) $response->getBody();
34
    }
35
}
36