blob: a691c7f50c9b76e8651b9be977f7d85ff933f03e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<?php
namespace BjoernrDe\SSLLabsApi\Calls;
use BjoernrDe\SSLLabsApi\Objects\Endpoint;
use BjoernrDe\SSLLabsApi\Exceptions\InvalidScopeException;
use BjoernrDe\SSLLabsApi\Exceptions\MissingApiParameterException;
/**
* API Call 'getEndpointData'
*
* @author Björn Roland
*/
class GetEndpointDataCall extends GenericCall
{
/**
* Class constructor
*
* @param array $parameters
*/
public function __construct($parameters = array())
{
if (!is_array($parameters))
{
throw new InvalidScopeException('Parameters must be an array');
}
else if (!isset($parameters['host']) || empty($parameters['host']))
{
throw new MissingApiParameterException('Missing host parameter');
}
else if (!isset($parameters['s']) || empty($parameters['s']))
{
throw new MissingApiParameterException('Missing endpoint ip address (s) parameter');
}
parent::__construct('getEndpointData', $parameters);
}
/**
* Send API call
*
* @return SSLLabsApi\Objects\Host
* @see SSLLabsApi\Calls\GenericCall::send()
*/
public function send()
{
$response = parent::send();
$endpointObject = new Endpoint();
return ($endpointObject->populateObjectByApiResponse($response));
}
}
|