diff options
Diffstat (limited to 'src/Calls/AnalyzeCall.php')
-rw-r--r-- | src/Calls/AnalyzeCall.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/Calls/AnalyzeCall.php b/src/Calls/AnalyzeCall.php new file mode 100644 index 0000000..4a4dff8 --- /dev/null +++ b/src/Calls/AnalyzeCall.php @@ -0,0 +1,47 @@ +<?php +namespace BjoernrDe\SSLLabsApi\Calls; + +use BjoernrDe\SSLLabsApi\Objects\Host; +use BjoernrDe\SSLLabsApi\Exceptions\InvalidScopeException; +use BjoernrDe\SSLLabsApi\Exceptions\MissingApiParameterException; + +/** + * API Call 'analyze' + * + * @author Björn Roland + */ +class AnalyzeCall extends GenericCall +{ + /** + * Class constructor + * + * @param array $parameters + */ + public function __construct($parameters = array()) + { + if (!is_array($parameters)) + { + throw new InvalidScopeException('Parameters must be an array'); + } + if (!isset($parameters['host']) || empty($parameters['host'])) + { + throw new MissingApiParameterException('Missing host parameter'); + } + + parent::__construct('analyze', $parameters); + } + + /** + * Send API call + * + * @return SSLLabsApi\Objects\Host + * @see SSLLabsApi\Calls\GenericCall::send() + */ + public function send() + { + $response = parent::send(); + $hostObject = new Host(); + + return ($hostObject->populateObjectByApiResponse($response)); + } +}
\ No newline at end of file |