summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Roland <bjoern.roland@intradesys.com>2015-11-18 00:01:35 +0100
committerBjörn Roland <bjoern.roland@intradesys.com>2015-11-18 00:01:35 +0100
commit1c880fae48099471dc6a2155c205b8d539e3a31b (patch)
treefed41010343287cb4b0271768f8c651fe1685ee1
parent325a9e3e422215e9df3c7887a894a22f6594a368 (diff)
downloadphp-ssllabs-api-1c880fae48099471dc6a2155c205b8d539e3a31b.zip
php-ssllabs-api-1c880fae48099471dc6a2155c205b8d539e3a31b.tar.gz
php-ssllabs-api-1c880fae48099471dc6a2155c205b8d539e3a31b.tar.bz2
Composer support ; started response object to PHP object mapping, Exceptions, Calls
-rw-r--r--composer.json32
-rw-r--r--src/Calls/AnalyzeCall.php47
-rw-r--r--src/Calls/GenericCall.php133
-rw-r--r--src/Calls/GetEndpointDataCall.php51
-rw-r--r--src/Calls/InfoCall.php34
-rw-r--r--src/Exceptions/ApiErrorException.php7
-rw-r--r--src/Exceptions/InvalidScopeException.php7
-rw-r--r--src/Exceptions/MissingApiParameterException.php7
-rw-r--r--src/Objects/ApiObject.php17
-rw-r--r--src/Objects/Cert.php260
-rw-r--r--src/Objects/Chain.php61
-rw-r--r--src/Objects/ChainCert.php20
-rw-r--r--src/Objects/Endpoint.php328
-rw-r--r--src/Objects/EndpointDetails.php565
-rw-r--r--src/Objects/Host.php428
-rw-r--r--src/Objects/Info.php215
-rw-r--r--src/Objects/Key.php80
-rw-r--r--src/Objects/Protocol.php11
-rw-r--r--src/Objects/SimClient.php11
-rw-r--r--src/Objects/SimDetails.php7
-rw-r--r--src/Objects/StatusCodes.php7
-rw-r--r--src/Objects/Suite.php16
-rw-r--r--src/Objects/Suites.php8
23 files changed, 2352 insertions, 0 deletions
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..45483b2
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,32 @@
+{
+ "name" : "bjoernr-de/php-ssllabs-api",
+ "type" : "library",
+ "description" : "PHP library to fetch data from SSL Labs API",
+ "homepage" : "https://github.com/bjoernr-de/php-ssllabs-api",
+ "license" : "GNU GPL v3",
+ "authors" : [{
+ "name" : "Björn Roland",
+ "email" : "dev@bjoernr.de",
+ "homepage" : "https://github.com/bjoernr-de/php-ssllabs-api",
+ "role" : "Developer"
+ }
+ ],
+ "require" : {
+ "php" : ">=5.3.0",
+ "phpunit/phpunit" : "4.8.*",
+ "phpdocumentor/phpdocumentor" : "2.*"
+ },
+ "autoload" : {
+ "psr-4" : {
+ "BjoernrDe\\SSLLabsApi\\" : "src/"
+ }
+ },
+ "autoload-dev" : {
+ "psr-4" : {
+ "BjoernrDe\\SSLLabsApi\\" : [
+ "src/",
+ "tests/"
+ ]
+ }
+ }
+} \ No newline at end of file
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
diff --git a/src/Calls/GenericCall.php b/src/Calls/GenericCall.php
new file mode 100644
index 0000000..f8d886c
--- /dev/null
+++ b/src/Calls/GenericCall.php
@@ -0,0 +1,133 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Calls;
+
+use BjoernrDe\SSLLabsApi\Exceptions\ApiErrorException;
+
+class GenericCall
+{
+ CONST API_URL = "https://api.ssllabs.com/api/v2";
+ CONST DEV_API_URL = "https://api.dev.ssllabs.com/api/v2/";
+
+ /**
+ * Api call
+ * @var string
+ */
+ private $apiCall;
+
+ /**
+ * Additional parameters for Api call
+ * i.e. hostname in analyze api call
+ *
+ * @var array
+ */
+ private $parameters;
+
+ /**
+ * DEV-Mode on|off
+ * If true ssllabs dev api is used for api calls
+ *
+ * @var boolean
+ */
+ private $devMode = false;
+
+ /**
+ * Class constructor
+ *
+ * @param string $apiCall
+ * @param array $parameters
+ */
+ public function __construct($apiCall, $parameters = array())
+ {
+ $this->apiCall = $apiCall;
+ $this->parameters = $parameters;
+ }
+
+ /**
+ * Get DEV mode
+ *
+ * @return boolean
+ */
+ public function getDevMode()
+ {
+ return ($this->devMode);
+ }
+
+ /**
+ * Set DEV mode on or off
+ *
+ * @param boolean $devMode
+ */
+ public function setDevMode($devMode)
+ {
+ $this->devMode = (boolean) $devMode;
+ }
+
+ /**
+ * Send request
+ *
+ * @throws ApiErrorException
+ * @return string|boolean JSON Api reponse or false
+ */
+ public function send()
+ {
+ if (!empty($this->apiCall))
+ {
+ //we also want content from failed api responses
+ $context = stream_context_create
+ (
+ array
+ (
+ 'http' => array
+ (
+ 'ignore_errors' => true,
+ 'timeout' => 5
+ )
+ )
+ );
+
+ $apiUrl = $this->getDevMode() ? self::DEV_API_URL : self::API_URL;
+ $apiResponse = @file_get_contents($apiUrl . '/' . $this->apiCall . $this->buildGetParameterString($this->parameters), false, $context);
+
+ if ($apiResponse === false)
+ {
+ throw new ApiErrorException('No response from API');
+ }
+
+ return ($apiResponse);
+ }
+
+ return (false);
+ }
+
+ /**
+ * Build GET parameter string for API
+ * + performs boolean to string (true = 'on' ; false = 'off') operation
+ *
+ * @param array $parameters
+ */
+ private function buildGetParameterString($parameters)
+ {
+ $string = '';
+
+ $counter = 0;
+ foreach ($parameters as $name => $value)
+ {
+ if (!is_string($name) || (!is_string($value) && !is_bool($value) && !is_int($value)))
+ {
+ continue;
+ }
+
+ if (is_bool($value))
+ {
+ $value = ($value) ? 'on' : 'off';
+ }
+
+ $string .= ($counter == 0) ? '?' : '&';
+ $string .= urlencode($name) . '=' . urlencode($value);
+
+ $counter++;
+ }
+
+ return ($string);
+ }
+} \ No newline at end of file
diff --git a/src/Calls/GetEndpointDataCall.php b/src/Calls/GetEndpointDataCall.php
new file mode 100644
index 0000000..a691c7f
--- /dev/null
+++ b/src/Calls/GetEndpointDataCall.php
@@ -0,0 +1,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));
+ }
+} \ No newline at end of file
diff --git a/src/Calls/InfoCall.php b/src/Calls/InfoCall.php
new file mode 100644
index 0000000..90752ce
--- /dev/null
+++ b/src/Calls/InfoCall.php
@@ -0,0 +1,34 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Calls;
+
+use BjoernrDe\SSLLabsApi\Objects\Info;
+
+/**
+ * API Call 'info'
+ *
+ * @author Björn Roland
+ */
+class InfoCall extends GenericCall
+{
+ /**
+ * Class constructor
+ */
+ public function __construct()
+ {
+ parent::__construct('info');
+ }
+
+ /**
+ * Send API call
+ *
+ * @return SSLLabsApi\Objects\Info
+ * @see SSLLabsApi\Calls\GenericCall::send()
+ */
+ public function send()
+ {
+ $response = parent::send();
+ $infoObject = new Info();
+
+ return ($infoObject->populateObjectByApiResponse($response));
+ }
+} \ No newline at end of file
diff --git a/src/Exceptions/ApiErrorException.php b/src/Exceptions/ApiErrorException.php
new file mode 100644
index 0000000..0f808be
--- /dev/null
+++ b/src/Exceptions/ApiErrorException.php
@@ -0,0 +1,7 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Exceptions;
+
+class ApiErrorException extends \Exception
+{
+
+} \ No newline at end of file
diff --git a/src/Exceptions/InvalidScopeException.php b/src/Exceptions/InvalidScopeException.php
new file mode 100644
index 0000000..15d0ab9
--- /dev/null
+++ b/src/Exceptions/InvalidScopeException.php
@@ -0,0 +1,7 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Exceptions;
+
+class InvalidScopeException extends \Exception
+{
+
+} \ No newline at end of file
diff --git a/src/Exceptions/MissingApiParameterException.php b/src/Exceptions/MissingApiParameterException.php
new file mode 100644
index 0000000..39db939
--- /dev/null
+++ b/src/Exceptions/MissingApiParameterException.php
@@ -0,0 +1,7 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Exceptions;
+
+class MissingApiParameterException extends \Exception
+{
+
+} \ No newline at end of file
diff --git a/src/Objects/ApiObject.php b/src/Objects/ApiObject.php
new file mode 100644
index 0000000..e9063b8
--- /dev/null
+++ b/src/Objects/ApiObject.php
@@ -0,0 +1,17 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Objects;
+
+/**
+ * ApiObject interface
+ *
+ * @author Björn Roland
+ */
+interface ApiObject
+{
+ /**
+ * Populate object by API response
+ *
+ * @param string $jsonString
+ */
+ public function populateObjectByApiResponse($jsonString);
+} \ No newline at end of file
diff --git a/src/Objects/Cert.php b/src/Objects/Cert.php
new file mode 100644
index 0000000..7afd203
--- /dev/null
+++ b/src/Objects/Cert.php
@@ -0,0 +1,260 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Objects;
+
+class Cert implements ApiObject
+{
+ private $subject;
+ private $commonNames = array();
+ private $altNames = array();
+ private $notBefore;
+ private $notAfter;
+ private $issuerSubject;
+ private $sigAlg;
+ private $issuerLabel;
+ private $revocationInfo;
+ private $crlURIs = array();
+ private $ocspURIs = array();
+ private $revocationStatus;
+ private $crlRevocationStatus;
+ private $ocspRevocationStatus;
+ private $sgc;
+ private $validationType;
+ private $issues;
+ private $sct;
+ private $sha1Hash;
+ private $pinSha256;
+
+ public function getSubject()
+ {
+ return ($this->subject);
+ }
+
+ private function setSubject($subject)
+ {
+ $this->subject = $subject;
+ }
+
+ public function getCommonNames()
+ {
+ return ($this->commonNames);
+ }
+
+ private function setCommonNames($commonNames)
+ {
+ $this->commonNames = (array) $commonNames;
+ }
+
+ public function getAltNames()
+ {
+ return ($this->altNames);
+ }
+
+ private function setAltNames($altNames)
+ {
+ $this->altNames = (array) $altNames;
+ }
+
+ public function getNotBefore()
+ {
+ return ($this->notBefore);
+ }
+
+ private function setNotBefore($notBefore)
+ {
+ $this->notBefore = $notBefore;
+ }
+
+ public function getNotAfter()
+ {
+ return ($this->notAfter);
+ }
+
+ private function setNotAfter($notAfter)
+ {
+ $this->notAfter = $notAfter;
+ }
+
+ public function getIssuerSubject()
+ {
+ return ($this->issuerSubject);
+ }
+
+ private function setIssuerSubject($issuerSubject)
+ {
+ $this->issuerSubject = $issuerSubject;
+ }
+
+ public function getSigAlg()
+ {
+ return ($this->sigAlg);
+ }
+
+ private function setSigAlg($sigAlg)
+ {
+ $this->sigAlg = $sigAlg;
+ }
+
+ public function getIssuerLabel()
+ {
+ return ($this->issuerLabel);
+ }
+
+ private function setIssuerLabel($issuerLabel)
+ {
+ $this->issuerLabel = $issuerLabel;
+ }
+
+ public function getRevocationInfo()
+ {
+ return ($this->revocationInfo);
+ }
+
+ private function setRevocationInfo($revocationInfo)
+ {
+ $this->revocationInfo = $revocationInfo;
+ }
+
+ public function getCrlURIs()
+ {
+ return ($this->crlURIs);
+ }
+
+ private function setCrlURIs($crlURIs)
+ {
+ $this->crlURIs = (array) $crlURIs;
+ }
+
+ public function getOcspURIs()
+ {
+ return ($this->ocspURIs);
+ }
+
+ private function setOcspURIs($ocspURIs)
+ {
+ $this->ocspURIs = (array) $ocspURIs;
+ }
+
+ public function getRevocationStatus()
+ {
+ return ($this->revocationStatus);
+ }
+
+ private function setRevocationStatus($revocationStatus)
+ {
+ $this->revocationStatus = $revocationStatus;
+ }
+
+ public function getCrlRevocationStatus()
+ {
+ return ($this->crlRevocationStatus);
+ }
+
+ private function setCrlRevocationStatus($crlRevocationStatus)
+ {
+ $this->crlRevocationStatus = $crlRevocationStatus;
+ }
+
+ public function getOcspRevocationStatus()
+ {
+ return ($this->ocspRevocationStatus);
+ }
+
+ private function setOcspRevocationStatus($ocspRevocationStatus)
+ {
+ $this->ocspRevocationStatus = $ocspRevocationStatus;
+ }
+
+ public function getSgc()
+ {
+ return ($this->sgc);
+ }
+
+ private function setSgc($sgc)
+ {
+ $this->sgc = $sgc;
+ }
+
+ public function getValidationType()
+ {
+ return ($this->validationType);
+ }
+
+ private function setValidationType($validationType)
+ {
+ $this->validationType = $validationType;
+ }
+
+ public function getIssues()
+ {
+ return ($this->issues);
+ }
+
+ private function setIssues($issues)
+ {
+ $this->issues = $issues;
+ }
+
+ public function getSct()
+ {
+ return ($this->sct);
+ }
+
+ private function setSct($sct)
+ {
+ $this->sct = $sct;
+ }
+
+ public function getSha1Hash()
+ {
+ return ($this->sha1Hash);
+ }
+
+ private function setSha1Hash($sha1Hash)
+ {
+ $this->sha1Hash = $sha1Hash;
+ }
+
+ public function getPinSha256()
+ {
+ return ($this->pinSha256);
+ }
+
+ private function setPinSha256($pinSha256)
+ {
+ $this->pinSha256 = $pinSha256;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return \SSLLabsApi\Objects\Cert
+ * @see \SSLLabsApi\Objects\ApiObject::populateObjectByApiResponse()
+ */
+ public function populateObjectByApiResponse($jsonString)
+ {
+ $response = json_decode($jsonString);
+
+ isset($response->subject) ? $this->setSubject($response->subject) : '';
+ isset($response->commonNames) ? $this->setCommonNames($response->commonNames) : '';
+ isset($response->altNames) ? $this->setAltNames($response->altNames) : '';
+ isset($response->notBefore) ? $this->setNotBefore($response->notBefore) : '';
+ isset($response->notAfter) ? $this->setNotAfter($response->notAfter) : '';
+ isset($response->issuerSubject) ? $this->setIssuerSubject($response->issuerSubject) : '';
+ isset($response->issuerLabel) ? $this->setIssuerLabel($response->issuerLabel) : '';
+ isset($response->sigAlg) ? $this->setSigAlg($response->sigAlg) : '';
+ isset($response->revocationInfo) ? $this->setRevocationInfo($response->revocationInfo) : '';
+ isset($response->crlURIs) ? $this->setCrlURIs($response->crlURIs) : '';
+ isset($response->ocspURIs) ? $this->setOcspURIs($response->ocspURIs) : '';
+ isset($response->revocationStatus) ? $this->setRevocationStatus($response->revocationStatus) : '';
+ isset($response->crlRevocationStatus) ? $this->setCrlRevocationStatus($response->crlRevocationStatus) : '';
+ isset($response->ocspRevocationStatus) ? $this->setOcspRevocationStatus($response->ocspRevocationStatus) : '';
+ isset($response->sgc) ? $this->setSgc($response->sgc) : '';
+ isset($response->issues) ? $this->setIssues($response->issues) : '';
+ isset($response->sct) ? $this->setSct($response->sct) : '';
+ isset($response->sha1Hash) ? $this->setSha1Hash($response->sha1Hash) : '';
+ isset($response->pinSha256) ? $this->setPinSha256($response->pinSha256) : '';
+
+ return ($this);
+ }
+
+} \ No newline at end of file
diff --git a/src/Objects/Chain.php b/src/Objects/Chain.php
new file mode 100644
index 0000000..1ec239c
--- /dev/null
+++ b/src/Objects/Chain.php
@@ -0,0 +1,61 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Objects;
+
+class Chain implements ApiObject
+{
+ private $chain = array();
+ private $issues;
+
+ public function getChain()
+ {
+ return ($this->chain);
+ }
+
+ private function setChain($chain)
+ {
+ $this->chain = $chain;
+ }
+
+ public function getIssues()
+ {
+ return ($this->issues);
+ }
+
+ private function setIssues($issues)
+ {
+ $this->issues = $issues;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return \SSLLabsApi\Objects\Cert
+ * @see \SSLLabsApi\Objects\ApiObject::populateObjectByApiResponse()
+ */
+ public function populateObjectByApiResponse($jsonString)
+ {
+ $response = json_decode($jsonString);
+
+ isset($response->subject) ? $this->setSubject($response->subject) : '';
+ isset($response->commonNames) ? $this->setCommonNames($response->commonNames) : '';
+ isset($response->altNames) ? $this->setAltNames($response->altNames) : '';
+ isset($response->notBefore) ? $this->setNotBefore($response->notBefore) : '';
+ isset($response->notAfter) ? $this->setNotAfter($response->notAfter) : '';
+ isset($response->issuerSubject) ? $this->setIssuerSubject($response->issuerSubject) : '';
+ isset($response->issuerLabel) ? $this->setIssuerLabel($response->issuerLabel) : '';
+ isset($response->sigAlg) ? $this->setSigAlg($response->sigAlg) : '';
+ isset($response->revocationInfo) ? $this->setRevocationInfo($response->revocationInfo) : '';
+ isset($response->crlURIs) ? $this->setCrlURIs($response->crlURIs) : '';
+ isset($response->ocspURIs) ? $this->setOcspURIs($response->ocspURIs) : '';
+ isset($response->revocationStatus) ? $this->setRevocationStatus($response->revocationStatus) : '';
+ isset($response->crlRevocationStatus) ? $this->setCrlRevocationStatus($response->crlRevocationStatus) : '';
+ isset($response->ocspRevocationStatus) ? $this->setOcspRevocationStatus($response->ocspRevocationStatus) : '';
+ isset($response->sgc) ? $this->setSgc($response->sgc) : '';
+ isset($response->issues) ? $this->setIssues($response->issues) : '';
+ isset($response->sct) ? $this->setSct($response->sct) : '';
+ isset($response->sha1Hash) ? $this->setSha1Hash($response->sha1Hash) : '';
+ isset($response->pinSha256) ? $this->setPinSha256($response->pinSha256) : '';
+
+ return ($this);
+ }
+} \ No newline at end of file
diff --git a/src/Objects/ChainCert.php b/src/Objects/ChainCert.php
new file mode 100644
index 0000000..5a4ef59
--- /dev/null
+++ b/src/Objects/ChainCert.php
@@ -0,0 +1,20 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Objects;
+
+class ChainCert
+{
+ private $subject;
+ private $label;
+ private $notBefore;
+ private $notAfter;
+ private $issuerSubject;
+ private $issuerLabel;
+ private $sigAlg;
+ private $issues;
+ private $keyAlg;
+ private $keySize;
+ private $keyStrength;
+ private $revocationStatus;
+ private $crlRevocationStatus;
+ private $raw;
+} \ No newline at end of file
diff --git a/src/Objects/Endpoint.php b/src/Objects/Endpoint.php
new file mode 100644
index 0000000..790bee5
--- /dev/null
+++ b/src/Objects/Endpoint.php
@@ -0,0 +1,328 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Objects;
+
+class Endpoint implements ApiObject
+{
+ private $ipAddress;
+ private $serverName;
+ private $statusMessage;
+ private $statusDetails;
+ private $statusDetailsMessage;
+ private $grade;
+ private $gradeTrustIgnored;
+ private $hasWarnings;
+ private $isExceptional;
+ private $progress;
+ private $duration;
+ private $eta;
+ private $delegation;
+ private $details = array();
+
+ /**
+ * Get endpoint ip address (in IPv4 or IPv6 format)
+ *
+ * @return string
+ */
+ public function getIpAddress()
+ {
+ return ($this->ipAddress);
+ }
+
+ /**
+ * Set endpoint ip address (in IPv4 or IPv6 format)
+ *
+ * @param string $ipAddress
+ */
+ private function setIpAddress($ipAddress)
+ {
+ $this->ipAddress = (string) $ipAddress;
+ }
+
+ /**
+ * Get sever name (reverse DNS entry)
+ *
+ * @return string
+ */
+ public function getServerName()
+ {
+ return ($this->serverName);
+ }
+
+ /**
+ * Set server name
+ *
+ * @param string $serverName
+ */
+ private function setServerName($serverName)
+ {
+ $this->serverName = (string) $serverName;
+ }
+
+ /**
+ * Get status message
+ *
+ * @return string
+ */
+ public function getStatusMessage()
+ {
+ return ($this->statusMessage);
+ }
+
+ /**
+ * Set status message
+ *
+ * @param string $statusMessage
+ */
+ private function setStatusMessage($statusMessage)
+ {
+ $this->statusMessage = (string) $statusMessage;
+ }
+
+ /**
+ * Get status details
+ *
+ * @return string
+ */
+ public function getStatusDetails()
+ {
+ return ($this->statusDetails);
+ }
+
+ /**
+ * Set status details
+ *
+ * @param string $statusDetails
+ */
+ private function setStatusDetails($statusDetails)
+ {
+ $this->statusDetails = (string) $statusDetails;
+ }
+
+ /**
+ * Get status details message
+ *
+ * @return string
+ */
+ public function getStatusDetailsMessage()
+ {
+ return ($this->statusDetailsMessage);
+ }
+
+ /**
+ * Set status details message
+ *
+ * @param string $statusDetailsMessage
+ */
+ private function setStatusDetailsMessage($statusDetailsMessage)
+ {
+ $this->statusDetailsMessage = (string) $statusDetailsMessage;
+ }
+
+ /**
+ * Get grade
+ *
+ * @return string
+ */
+ public function getGrade()
+ {
+ return ($this->grade);
+ }
+
+ /**
+ * Set grade
+ *
+ * @param string $grade
+ */
+ private function setGrade($grade)
+ {
+ $this->grade = (string) $grade;
+ }
+
+ /**
+ * Get grade if trust issues are ignored
+ */
+ public function getGradeTrustIgnored()
+ {
+ return ($this->gradeTrustIgnored);
+ }
+
+ /**
+ * Set grade if trust issues are ignored
+ *
+ * @param string $gradeTrustIgnored
+ */
+ private function setGradeTrustIgnored($gradeTrustIgnored)
+ {
+ $this->gradeTrustIgnored = (string) $gradeTrustIgnored;
+ }
+
+ /**
+ * Get hasWarnings
+ *
+ * @return boolean
+ */
+ public function getHasWarnings()
+ {
+ return ($this->hasWarnings);
+ }
+
+ /**
+ * Set hasWarnings
+ *
+ * @param boolean $hasWarnings
+ */
+ private function setHasWarnings($hasWarnings)
+ {
+ $this->hasWarnings = (boolean) $hasWarnings;
+ }
+
+ /**
+ * Get isExceptional
+ *
+ * @return boolean
+ */
+ public function getIsExceptional()
+ {
+ return ($this->isExceptional);
+ }
+
+ /**
+ * Set isExceptional
+ *
+ * @param boolean $isExceptional
+ */
+ private function setIsExceptional($isExceptional)
+ {
+ $this->isExceptional = (boolean) $isExceptional;
+ }
+
+ /**
+ * Get progress
+ *
+ * @return int
+ */
+ public function getProgress()
+ {
+ return ($this->progress);
+ }
+
+ /**
+ * Set progress
+ *
+ * @param int $progress
+ */
+ private function setProgress($progress)
+ {
+ $this->progress = (int) $progress;
+ }
+
+ /**
+ * Get duration in milliseconds
+ *
+ * @return int
+ */
+ public function getDuration()
+ {
+ return ($this->duration);
+ }
+
+ /**
+ * Set duration in milliseconds
+ *
+ * @param int $duration
+ */
+ private function setDuration($duration)
+ {
+ $this->duration = (int) $duration;
+ }
+
+ /**
+ * Get ETA in seconds
+ */
+ public function getEta()
+ {
+ return ($this->eta);
+ }
+
+ /**
+ * Set ETA in seconds
+ *
+ * @param int $eta
+ */
+ private function setEta($eta)
+ {
+ $this->eta = (int) $eta;
+ }
+
+ /**
+ * Get delegation
+ *
+ * @return int
+ */
+ public function getDelegation()
+ {
+ return ($this->delegation);
+ }
+
+ /**
+ * Set delegation
+ *
+ * @param int $delegation
+ */
+ private function setDelegation($delegation)
+ {
+ $this->delegation = (int) $delegation;
+ }
+
+ /**
+ * Get details
+ *
+ * @return array
+ */
+ public function getDetails()
+ {
+ return ($this->details);
+ }
+
+ /**
+ * Set details
+ *
+ * @param array $details
+ */
+ private function setDetails($details)
+ {
+ $this->details = (array) $details;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return \BjoernrDe\SSLLabsApi\Objects\Endpoint
+ * @see \BjoernrDe\SSLLabsApi\Objects\ApiObject::populateObjectByApiResponse()
+ */
+ public function populateObjectByApiResponse($jsonString)
+ {
+ $response = json_decode($jsonString);
+
+ isset($response->ipAddress) ? $this->setIpAddress($response->ipAddress) : '';
+ isset($response->statusMessage) ? $this->setStatusMessage($response->statusMessage) : '';
+ isset($response->grade) ? $this->setGrade($response->grade) : '';
+ isset($response->gradeTrustIgnored) ? $this->setGradeTrustIgnored($response->gradeTrustIgnored) : '';
+ isset($response->hasWarnings) ? $this->setHasWarnings($response->hasWarnings) : '';
+ isset($response->isExceptional) ? $this->setIsExceptional($response->isExceptional) : '';
+ isset($response->progress) ? $this->setProgress($response->progress) : '';
+ isset($response->duration) ? $this->setDuration($response->duration) : '';
+ isset($response->eta) ? $this->setEta($response->eta) : '';
+ isset($response->delegation) ? $this->setDelegation($response->delegation) : '';
+
+ if(isset($response->details) && !empty($response->details))
+ {
+ $endpointDetailsObject = new EndpointDetails();
+ $endpointDetailsObject->populateObjectByApiResponse(json_encode($response->details));
+
+ $this->setDetails($endpointDetailsObject);
+ }
+
+ return ($this);
+ }
+} \ No newline at end of file
diff --git a/src/Objects/EndpointDetails.php b/src/Objects/EndpointDetails.php
new file mode 100644
index 0000000..a3dc52f
--- /dev/null
+++ b/src/Objects/EndpointDetails.php
@@ -0,0 +1,565 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Objects;
+
+class EndpointDetails implements ApiObject
+{
+ private $hostStartTime;
+ private $key;
+ private $cert;
+ private $chain;
+ private $protocols = array();
+ private $suites;
+ private $serverSignature;
+ private $prefixDelegation;
+ private $nonPrefixDelegation;
+ private $vulnBeast;
+ private $renegSupport;
+ private $stsStatus;
+ private $stsReponseHeader;
+ private $stsMaxAge;
+ private $stsSubdomains;
+ private $stsPreload;
+ private $pkpResponseHeader;
+ private $sessionResumption;
+ private $compressionMethods;
+ private $suportsNpn;
+ private $npnProtocols;
+ private $sessionTickets;
+ private $ocspStapling;
+ private $staplingRevocationStatus;
+ private $staplingRevocationErrorMessage;
+ private $sniRequired;
+ private $httpStatusCode;
+ private $httpForwarding;
+ private $supportsRc4;
+ private $rc4WithModern;
+ private $rc4Only;
+ private $forwardSecrecy;
+ private $sims;
+ private $heartbleed;
+ private $heartbeat;
+ private $openSslCcs;
+ private $poodle;
+ private $poodleTls;
+ private $fallbackScsv;
+ private $freak;
+ private $hasSct;
+ private $dhPrimes = array();
+ private $dhUsesKnownPrimes;
+ private $dhYsReuse;
+ private $logjam;
+ private $chaCha20Preference;
+
+ public function getHostStartTime()
+ {
+ return ($this->hostStartTime);
+ }
+
+ private function setHostStartTime($hostStartTime)
+ {
+ $this->hostStartTime = $hostStartTime;
+ }
+
+ public function getKey()
+ {
+ return ($this->key);
+ }
+
+ private function setKey(Key $key)
+ {
+ $this->key = $key;
+ }
+
+ public function getCert()
+ {
+ return ($this->cert);
+ }
+
+ private function setCert($cert)
+ {
+ $this->cert = $cert;
+ }
+
+ public function getChain()
+ {
+ return ($this->chain);
+ }
+
+ private function setChain($chain)
+ {
+ $this->chain = $chain;
+ return $this;
+ }
+
+ public function getProtocols()
+ {
+ return ($this->protocols);
+ }
+
+ private function setProtocols($protocols)
+ {
+ $this->protocols = $protocols;
+ }
+
+ public function getSuites()
+ {
+ return ($this->suites);
+ }
+
+ private function setSuites($suites)
+ {
+ $this->suites = $suites;
+ }
+
+ public function getServerSignature()
+ {
+ return ($this->serverSignature);
+ }
+
+ private function setServerSignature($serverSignature)
+ {
+ $this->serverSignature = $serverSignature;
+ }
+
+ public function getPrefixDelegation()
+ {
+ return ($this->prefixDelegation);
+ }
+
+ private function setPrefixDelegation($prefixDelegation)
+ {
+ $this->prefixDelegation = $prefixDelegation;
+ }
+
+ public function getNonPrefixDelegation()
+ {
+ return ($this->nonPrefixDelegation);
+ }
+
+ private function setNonPrefixDelegation($nonPrefixDelegation)
+ {
+ $this->nonPrefixDelegation = $nonPrefixDelegation;
+ }
+
+ public function getVulnBeast()
+ {
+ return ($this->vulnBeast);
+ }
+
+ private function setVulnBeast($vulnBeast)
+ {
+ $this->vulnBeast = $vulnBeast;
+ }
+
+ public function getRenegSupport()
+ {
+ return ($this->renegSupport);
+ }
+
+ private function setRenegSupport($renegSupport)
+ {
+ $this->renegSupport = $renegSupport;
+ }
+
+ public function getStsStatus()
+ {
+ return ($this->stsStatus);
+ }
+
+ private function setStsStatus($stsStatus)
+ {
+ $this->stsStatus = $stsStatus;
+ }
+
+ public function getStsReponseHeader()
+ {
+ return ($this->stsReponseHeader);
+ }
+
+ private function setStsReponseHeader($stsReponseHeader)
+ {
+ $this->stsReponseHeader = $stsReponseHeader;
+ }
+
+ public function getStsMaxAge()
+ {
+ return ($this->stsMaxAge);
+ }
+
+ private function setStsMaxAge($stsMaxAge)
+ {
+ $this->stsMaxAge = $stsMaxAge;
+ }
+
+ public function getStsSubdomains()
+ {
+ return ($this->stsSubdomains);
+ }
+
+ private function setStsSubdomains($stsSubdomains)
+ {
+ $this->stsSubdomains = $stsSubdomains;
+ }
+
+ public function getStsPreload()
+ {
+ return ($this->stsPreload);
+ }
+
+ private function setStsPreload($stsPreload)
+ {
+ $this->stsPreload = $stsPreload;
+ }
+
+ public function getPkpResponseHeader()
+ {
+ return ($this->pkpResponseHeader);
+ }
+
+ private function setPkpResponseHeader($pkpResponseHeader)
+ {
+ $this->pkpResponseHeader = $pkpResponseHeader;
+ }
+
+ public function getSessionResumption()
+ {
+ return ($this->sessionResumption);
+ }
+
+ private function setSessionResumption($sessionResumption)
+ {
+ $this->sessionResumption = $sessionResumption;
+ }
+
+ public function getCompressionMethods()
+ {
+ return ($this->compressionMethods);
+ }
+
+ private function setCompressionMethods($compressionMethods)
+ {
+ $this->compressionMethods = $compressionMethods;
+ }
+
+ public function getSuportsNpn()
+ {
+ return ($this->suportsNpn);
+ }
+
+ private function setSuportsNpn($suportsNpn)
+ {
+ $this->suportsNpn = $suportsNpn;
+ }
+
+ public function getNpnProtocols()
+ {
+ return ($this->npnProtocols);
+ }
+
+ private function setNpnProtocols($npnProtocols)
+ {
+ $this->npnProtocols = $npnProtocols;
+ }
+
+ public function getSessionTickets()
+ {
+ return ($this->sessionTickets);
+ }
+
+ private function setSessionTickets($sessionTickets)
+ {
+ $this->sessionTickets = $sessionTickets;
+ }
+
+ public function getOcspStapling()
+ {
+ return ($this->ocspStapling);
+ }
+
+ private function setOcspStapling($ocspStapling)
+ {
+ $this->ocspStapling = $ocspStapling;
+ }
+
+ public function getStaplingRevocationStatus()
+ {
+ return ($this->staplingRevocationStatus);
+ }
+
+ private function setStaplingRevocationStatus($staplingRevocationStatus)
+ {
+ $this->staplingRevocationStatus = $staplingRevocationStatus;
+ }
+
+ public function getStaplingRevocationErrorMessage()
+ {
+ return ($this->staplingRevocationErrorMessage);
+ }
+
+ private function setStaplingRevocationErrorMessage($staplingRevocationErrorMessage)
+ {
+ $this->staplingRevocationErrorMessage = $staplingRevocationErrorMessage;
+ }
+
+ public function getSniRequired()
+ {
+ return ($this->sniRequired);
+ }
+
+ private function setSniRequired($sniRequired)
+ {
+ $this->sniRequired = $sniRequired;
+ }
+
+ public function getHttpStatusCode()
+ {
+ return ($this->httpStatusCode);
+ }
+
+ private function setHttpStatusCode($httpStatusCode)
+ {
+ $this->httpStatusCode = $httpStatusCode;
+ }
+
+ public function getHttpForwarding()
+ {
+ return ($this->httpForwarding);
+ }
+
+ private function setHttpForwarding($httpForwarding)
+ {
+ $this->httpForwarding = $httpForwarding;
+ }
+
+ public function getSupportsRc4()
+ {
+ return ($this->supportsRc4);
+ }
+
+ private function setSupportsRc4($supportsRc4)
+ {
+ $this->supportsRc4 = $supportsRc4;
+ return $this;
+ }
+
+ public function getRc4WithModern()
+ {
+ return ($this->rc4WithModern);
+ }
+
+ private function setRc4WithModern($rc4WithModern)
+ {
+ $this->rc4WithModern = $rc4WithModern;
+ }
+
+ public function getRc4Only()
+ {
+ return ($this->rc4Only);
+ }
+
+ private function setRc4Only($rc4Only)
+ {
+ $this->rc4Only = $rc4Only;
+ }
+
+ public function getForwardSecrecy()
+ {
+ return ($this->forwardSecrecy);
+ }
+
+ private function setForwardSecrecy($forwardSecrecy)
+ {
+ $this->forwardSecrecy = $forwardSecrecy;
+ }
+
+ public function getSims()
+ {
+ return ($this->sims);
+ }
+
+ private function setSims($sims)
+ {
+ $this->sims = $sims;
+ }
+
+ public function getHeartbleed()
+ {
+ return ($this->heartbleed);
+ }
+
+ private function setHeartbleed($heartbleed)
+ {
+ $this->heartbleed = $heartbleed;
+ }
+
+ public function getHeartbeat()
+ {
+ return ($this->heartbeat);
+ }
+
+ private function setHeartbeat($heartbeat)
+ {
+ $this->heartbeat = $heartbeat;
+ }
+
+ public function getOpenSslCcs()
+ {
+ return ($this->openSslCcs);
+ }
+
+ private function setOpenSslCcs($openSslCcs)
+ {
+ $this->openSslCcs = $openSslCcs;
+ }
+
+ public function getPoodle()
+ {
+ return ($this->poodle);
+ }
+
+ private function setPoodle($poodle)
+ {
+ $this->poodle = $poodle;
+ }
+
+ public function getPoodleTls()
+ {
+ return ($this->poodleTls);
+ }
+
+ private function setPoodleTls($poodleTls)
+ {
+ $this->poodleTls = $poodleTls;
+ }
+
+ public function getFallbackScsv()
+ {
+ return ($this->fallbackScsv);
+ }
+
+ private function setFallbackScsv($fallbackScsv)
+ {
+ $this->fallbackScsv = $fallbackScsv;
+ }
+
+ public function getFreak()
+ {
+ return ($this->freak);
+ }
+
+ private function setFreak($freak)
+ {
+ $this->freak = $freak;
+ }
+
+ public function getHasSct()
+ {
+ return ($this->hasSct);
+ }
+
+ private function setHasSct($hasSct)
+ {
+ $this->hasSct = $hasSct;
+ }
+
+ public function getDhPrimes()
+ {
+ return ($this->dhPrimes);
+ }
+
+ private function setDhPrimes($dhPrimes)
+ {
+ $this->dhPrimes = $dhPrimes;
+ }
+
+ public function getDhUsesKnownPrimes()
+ {
+ return ($this->dhUsesKnownPrimes);
+ }
+
+ private function setDhUsesKnownPrimes($dhUsesKnownPrimes)
+ {
+ $this->dhUsesKnownPrimes = $dhUsesKnownPrimes;
+ }
+
+ public function getDhYsReuse()
+ {
+ return ($this->dhYsReuse);
+ }
+
+ private function setDhYsReuse($dhYsReuse)
+ {
+ $this->dhYsReuse = $dhYsReuse;
+ }
+
+ public function getLogjam()
+ {
+ return ($this->logjam);
+ }
+
+ private function setLogjam($logjam)
+ {
+ $this->logjam = $logjam;
+ }
+
+ public function getChaCha20Preference()
+ {
+ return ($this->chaCha20Preference);
+ }
+
+ private function setChaCha20Preference($chaCha20Preference)
+ {
+ $this->chaCha20Preference = $chaCha20Preference;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return \BjoernrDe\SSLLabsApi\Objects\EndpointDetails
+ * @see \BjoernrDe\SSLLabsApi\Objects\ApiObject::populateObjectByApiResponse()
+ */
+ public function populateObjectByApiResponse($jsonString)
+ {
+ $response = json_decode($jsonString);
+
+// echo "<pre>";
+// print_r($response);
+// echo "</pre>";
+// die();
+
+ isset($response->hostStartTime) ? $this->setHostStartTime($response->hostStartTime) : '';
+
+ if(isset($response->key) && !empty($response->key))
+ {
+ $keyObject = new Key();
+ $keyObject->populateObjectByApiResponse(json_encode($response->key));
+
+ $this->setKey($keyObject);
+ }
+
+ if(isset($response->cert) && !empty($response->cert))
+ {
+ $certObject = new Cert();
+ $certObject->populateObjectByApiResponse(json_encode($response->cert));
+
+ $this->setCert($certObject);
+ }
+
+ echo "<pre>";
+ print_r($this);
+ echo "</pre>";
+ die();
+ isset($response->statusMessage) ? $this->setStatusMessage($response->statusMessage) : '';
+ isset($response->grade) ? $this->setGrade($response->grade) : '';
+ isset($response->gradeTrustIgnored) ? $this->setGradeTrustIgnored($response->gradeTrustIgnored) : '';
+ isset($response->hasWarnings) ? $this->setHasWarnings($response->hasWarnings) : '';
+ isset($response->isExceptional) ? $this->setIsExceptional($response->isExceptional) : '';
+ isset($response->progress) ? $this->setProgress($response->progress) : '';
+ isset($response->duration) ? $this->setDuration($response->duration) : '';
+ isset($response->eta) ? $this->setEta($response->eta) : '';
+ isset($response->delegation) ? $this->setDelegation($response->delegation) : '';
+ //TODO: $response->details (EndpointDetail object)
+
+ return ($this);
+ }
+} \ No newline at end of file
diff --git a/src/Objects/Host.php b/src/Objects/Host.php
new file mode 100644
index 0000000..8ff487e
--- /dev/null
+++ b/src/Objects/Host.php
@@ -0,0 +1,428 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Objects;
+
+/**
+ * SSLLabs Host object
+ *
+ * @author Björn Roland
+ * @see https://github.com/ssllabs/ssllabs-scan/blob/master/ssllabs-api-docs.md#host
+ */
+
+class Host implements ApiObject
+{
+ /**
+ * Host that will be checked
+ *
+ * @var string $host
+ */
+ private $host;
+
+ /**
+ * Port
+ *
+ * @var int $port
+ */
+ private $port;
+
+ /**
+ * Protocol
+ *
+ * @var string $protocol
+ */
+ private $protocol;
+
+ /**
+ * True if the assessment is public (and listed on the SSLLabs assessments board)
+ * @var boolean $isPublic
+ */
+ private $isPublic;
+
+ /**
+ * Assessment status
+ *
+ * @var string $status
+ */
+ private $status;
+
+ /**
+ * Status message ; When status is error this contains an error message
+ *
+ * @var string $statusMessage
+ */
+ private $statusMessage;
+
+ /**
+ * startMessage
+ * TODO: Not documented in current API doc v1.20.17
+ *
+ * @var string $startMessage
+ */
+ private $startMessage;
+
+ /**
+ * Assessment start time (Unix timestamp; milliseconds since 1970)
+ *
+ * @var int $startTime
+ */
+ private $startTime;
+
+ /**
+ * Assessment completion time (Unix timestamp; milliseconds since 1970)
+ *
+ * @var int $testTime
+ */
+ private $testTime;
+
+ /**
+ * Assessment engine version
+ *
+ * @var string $engineVersion
+ */
+ private $engineVersion;
+
+ /**
+ * Criteria version
+ *
+ * @var string $criteriaVersion
+ */
+ private $criteriaVersion;
+
+ /**
+ * Time when assessment result will expire from cache
+ * @var string $cacheExpiryTime
+ */
+ private $cacheExpiryTime;
+
+ /**
+ * List of Endpoint objects
+ *
+ * @var array $endpoints
+ * @see \SSLLabsApi\Objects\Endpoint
+ */
+ private $endpoints = array();
+
+ /**
+ * List of certificate hostnames
+ *
+ * @var array $certHostnames
+ */
+ private $certHostnames = array();
+
+ /**
+ * Get host
+ *
+ * @return string
+ */
+ public function getHost()
+ {
+ return ($this->host);
+ }
+
+ /**
+ * Set host
+ *
+ * @param string $host
+ */
+ private function setHost($host)
+ {
+ $this->host = (string) $host;
+ }
+
+ /**
+ * Get port
+ *
+ * @return int
+ */
+ public function getPort()
+ {
+ return ($this->port);
+ }
+
+ /**
+ * Set port
+ *
+ * @param int $port
+ */
+ private function setPort($port)
+ {
+ $this->port = (int) $port;
+ }
+
+ /**
+ * Get protocol
+ *
+ * @return string
+ */
+ public function getProtocol()
+ {
+ return ($this->protocol);
+ }
+
+ /**
+ * Set protocol
+ *
+ * @param string $protocol
+ */
+ private function setProtocol($protocol)
+ {
+ $this->protocol = $protocol;
+ }
+
+ /**
+ * Get isPublic
+ *
+ * @return boolean
+ */
+ public function getIsPublic()
+ {
+ return ($this->isPublic);
+ }
+
+ /**
+ * Set isPublic
+ *
+ * @param boolean $isPublic
+ */
+ private function setIsPublic($isPublic)
+ {
+ $this->isPublic = (boolean) $isPublic;
+ }
+
+ /**
+ * Get status
+ *
+ * @return string
+ */
+ public function getStatus()
+ {
+ return ($this->status);
+ }
+
+ /**
+ * Set status
+ *
+ * @param string $status
+ */
+ private function setStatus($status)
+ {
+ $this->status = $status;
+ }
+
+ /**
+ * Get status message
+ *
+ * @return string
+ */
+ public function getStatusMessage()
+ {
+ return ($this->statusMessage);
+ }
+
+ /**
+ * Set status message
+ *
+ * @param string $statusMessage
+ */
+ private function setStatusMessage($statusMessage)
+ {
+ $this->statusMessage = $statusMessage;
+ }
+
+ /**
+ * Get start message
+ *
+ * @return string
+ */
+ public function getStartMessage()
+ {
+ return ($this->startMessage);
+ }
+
+ /**
+ * Set start message
+ *
+ * @param string $startMessage
+ */
+ private function setStartMessage($startMessage)
+ {
+ $this->startMessage = $startMessage;
+ }
+
+ /**
+ * Get start time
+ *
+ * @return int
+ */
+ public function getStartTime()
+ {
+ return ($this->startTime);
+ }
+
+ /**
+ * Set start time
+ *
+ * @param int $startTime
+ */
+ private function setStartTime($startTime)
+ {
+ $this->startTime = $startTime;
+ }
+
+ /**
+ * Get test time
+ *
+ * @return int
+ */
+ public function getTestTime()
+ {
+ return ($this->testTime);
+ }
+
+ /**
+ * Set test time
+ *
+ * @param int $testTime
+ */
+ private function setTestTime($testTime)
+ {
+ $this->testTime = $testTime;
+ }
+
+ /**
+ * Get engine version
+ *
+ * @return string
+ */
+ public function getEngineVersion()
+ {
+ return ($this->engineVersion);
+ }
+
+ /**
+ * Set engine version
+ *
+ * @param string $engineVersion
+ */
+ private function setEngineVersion($engineVersion)
+ {
+ $this->engineVersion = $engineVersion;
+ }
+
+ /**
+ * Get criteria version
+ *
+ * @return string
+ */
+ public function getCriteriaVersion()
+ {
+ return ($this->criteriaVersion);
+ }
+
+ /**
+ * Set criteria version
+ *
+ * @param string $criteriaVersion
+ */
+ private function setCriteriaVersion($criteriaVersion)
+ {
+ $this->criteriaVersion = $criteriaVersion;
+ }
+
+ /**
+ * Get cache expiry time
+ *
+ * @return string
+ */
+ public function getCacheExpiryTime()
+ {
+ return ($this->cacheExpiryTime);
+ }
+
+ /**
+ * Set cache expiry time
+ *
+ * @param string $cacheExpiryTime
+ */
+ private function setCacheExpiryTime($cacheExpiryTime)
+ {
+ $this->cacheExpiryTime = $cacheExpiryTime;
+ }
+
+ /**
+ * Get endpoints
+ *
+ * @return array
+ */
+ public function getEndpoints()
+ {
+ return ($this->endpoints);
+ }
+
+ /**
+ * Set endpoints
+ *
+ * @param array $endpoints
+ */
+ private function setEndpoints($endpoints)
+ {
+ $this->endpoints = (array)$endpoints;
+ }
+
+ /**
+ * Get cert hostnames
+ *
+ * @return array
+ */
+ public function getCertHostnames()
+ {
+ return ($this->certHostnames);
+ }
+
+ /**
+ * Set cert hostnames
+ *
+ * @param array $certHostnames
+ */
+ private function setCertHostnames($certHostnames)
+ {
+ $this->certHostnames = $certHostnames;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return \BjoernrDe\SSLLabsApi\Objects\Host
+ * @see \BjoernrDe\SSLLabsApi\Objects\ApiObject::populateObjectByApiResponse()
+ */
+ public function populateObjectByApiResponse($jsonString)
+ {
+ $response = json_decode($jsonString);
+
+ isset($response->host) ? $this->setHost($response->host) : '';
+ isset($response->port) ? $this->setPort($response->port) : '';
+ isset($response->protocol) ? $this->setProtocol($response->protocol) : '';
+ isset($response->isPublic) ? $this->setIsPublic($response->isPublic) : '';
+ isset($response->status) ? $this->setStatus($response->status) : '';
+ isset($response->startMessage) ? $this->setStartMessage($response->startMessage) : '';
+ isset($response->startTime) ? $this->setStartTime($response->startTime) : '';
+ isset($response->testTime) ? $this->setTestTime($response->testTime) : '';
+ isset($response->engineVersion) ? $this->setEngineVersion($response->engineVersion) : '';
+ isset($response->criteriaVersion) ? $this->setCriteriaVersion($response->criteriaVersion) : '';
+
+ if(isset($response->endpoints) && count($response->endpoints) > 0)
+ {
+ $endpointObjects = array();
+
+ foreach($response->endpoints as $endpoint)
+ {
+ $endpointObject = new Endpoint();
+ $endpointObject->populateObjectByApiResponse(json_encode($endpoint));
+ $endpointObjects[] = $endpointObject;
+ }
+
+ $this->setEndpoints($endpointObjects);
+ }
+
+ return ($this);
+ }
+} \ No newline at end of file
diff --git a/src/Objects/Info.php b/src/Objects/Info.php
new file mode 100644
index 0000000..bd7149c
--- /dev/null
+++ b/src/Objects/Info.php
@@ -0,0 +1,215 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Objects;
+
+/**
+ * SSLLabs Info object
+ *
+ * @author Björn Roland
+ * @see https://github.com/ssllabs/ssllabs-scan/blob/master/ssllabs-api-docs.md#info
+ */
+
+class Info implements ApiObject
+{
+ /**
+ * API engine version
+ * @var string
+ */
+ private $version;
+
+ /**
+ * API criteria version
+ * @var string $criteriaVersion
+ */
+ private $criteriaVersion;
+
+ /**
+ * Client max assessments
+ * @var int
+ */
+ private $clientMaxAssessments;
+
+ /**
+ * Max assessments
+ * @var int
+ */
+ private $maxAssessments;
+
+ /**
+ * Current assessments
+ * @var int
+ */
+ private $currentAssessments;
+
+ /**
+ * New assessments cool off time in milliseconds
+ * @var int
+ */
+ private $newAssessmentCoolOff;
+
+ /**
+ * API messages
+ * @var array
+ */
+ private $messages;
+
+ /**
+ * Get current API engine version
+ *
+ * @return string
+ */
+ public function getVersion()
+ {
+ return ($this->version);
+ }
+
+ /**
+ * Set API engine version
+ *
+ * @param string $version
+ */
+ private function setVersion($version)
+ {
+ $this->version = (string) $version;
+ }
+
+ /**
+ * Get criteria version
+ *
+ * @return string
+ */
+ public function getCriteriaVersion()
+ {
+ return ($this->criteriaVersion);
+ }
+
+ /**
+ * Set criteria version
+ *
+ * @param string $criteriaVersion
+ */
+ private function setCriteriaVersion($criteriaVersion)
+ {
+ $this->criteriaVersion = (string) $criteriaVersion;
+ }
+
+ /**
+ * Get client max assessments
+ *
+ * @return int
+ */
+ public function getClientMaxAssessments()
+ {
+ return ($this->clientMaxAssessments);
+ }
+
+ /**
+ * Set client max assessments
+ *
+ * @param int $clientMaxAssessments
+ */
+ private function setClientMaxAssessments($clientMaxAssessments)
+ {
+ $this->clientMaxAssessments = (int) $clientMaxAssessments;
+ }
+
+ /**
+ * Get max assessments
+ *
+ * @return int
+ */
+ public function getMaxAssessments()
+ {
+ return ($this->maxAssessments);
+ }
+
+ /**
+ * Set max assessments
+ *
+ * @param int $maxAssessments
+ */
+ private function setMaxAssessments($maxAssessments)
+ {
+ $this->maxAssessments = (int) $maxAssessments;
+ }
+
+ /**
+ * Get current assessments
+ *
+ * @return int
+ */
+ public function getCurrentAssessments()
+ {
+ return ($this->currentAssessments);
+ }
+
+ /**
+ * Set current assessments
+ *
+ * @param int $currentAssessments
+ */
+ private function setCurrentAssessments($currentAssessments)
+ {
+ $this->currentAssessments = (int) $currentAssessments;
+ }
+
+ /**
+ * Get new assessments cool off time in milliseconds
+ *
+ * @return int
+ */
+ public function getNewAssessmentCoolOff()
+ {
+ return ($this->newAssessmentCoolOff);
+ }
+
+ /**
+ * Set new assessments cool off time in milliseconds
+ *
+ * @param int $newAssessmentCoolOff
+ */
+ private function setNewAssessmentCoolOff($newAssessmentCoolOff)
+ {
+ $this->newAssessmentCoolOff = (int) $newAssessmentCoolOff;
+ }
+
+ /**
+ * Get messages
+ *
+ * @return array
+ */
+ public function getMessages()
+ {
+ return ($this->messages);
+ }
+
+ /**
+ * Set messages
+ *
+ * @param array $messages
+ */
+ private function setMessages($messages)
+ {
+ $this->messages = (array) $messages;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return \BjoernrDe\SSLLabsApi\Objects\Info
+ * @see \BjoernrDe\SSLLabsApi\Objects\ApiObject::populateObjectByApiResponse()
+ */
+ public function populateObjectByApiResponse($jsonString)
+ {
+ $response = json_decode($jsonString);
+
+ isset($response->engineVersion) ? $this->setVersion($response->engineVersion) : '';
+ isset($response->criteriaVersion) ? $this->setCriteriaVersion($response->criteriaVersion) : '';
+ isset($response->clientMaxAssessments) ? $this->setClientMaxAssessments($response->clientMaxAssessments) : '';
+ isset($response->maxAssessments) ? $this->setMaxAssessments($response->maxAssessments) : '';
+ isset($response->currentAssessments) ? $this->setCurrentAssessments($response->currentAssessments) : '';
+ isset($response->newAssessmentCoolOff) ? $this->setNewAssessmentCoolOff($response->newAssessmentCoolOff) : '';
+ isset($response->messages) ? $this->setMessages($response->messages) : '';
+
+ return ($this);
+ }
+} \ No newline at end of file
diff --git a/src/Objects/Key.php b/src/Objects/Key.php
new file mode 100644
index 0000000..c57a613
--- /dev/null
+++ b/src/Objects/Key.php
@@ -0,0 +1,80 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Objects;
+
+class Key implements ApiObject
+{
+ private $size;
+ private $strength;
+ private $alg;
+ private $debianFlaw;
+ private $q;
+
+ public function getSize()
+ {
+ return ($this->size);
+ }
+
+ private function setSize($size)
+ {
+ $this->size = $size;
+ }
+
+ public function getStrength()
+ {
+ return ($this->strength);
+ }
+
+ private function setStrength($strength)
+ {
+ $this->strength = $strength;
+ }
+
+ public function getAlg()
+ {
+ return ($this->alg);
+ }
+
+ private function setAlg($alg)
+ {
+ $this->alg = $alg;
+ }
+
+ public function getDebianFlaw()
+ {
+ return ($this->debianFlaw);
+ }
+
+ private function setDebianFlaw($debianFlaw)
+ {
+ $this->debianFlaw = $debianFlaw;
+ }
+
+ public function getQ()
+ {
+ return ($this->q);
+ }
+
+ private function setQ($q)
+ {
+ $this->q = $q;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return \BjoernrDe\SSLLabsApi\Objects\Key
+ * @see \BjoernrDe\SSLLabsApi\Objects\ApiObject::populateObjectByApiResponse()
+ */
+ public function populateObjectByApiResponse($jsonString)
+ {
+ $response = json_decode($jsonString);
+
+ isset($response->size) ? $this->setSize($response->size) : '';
+ isset($response->alg) ? $this->setAlg($response->alg) : '';
+ isset($response->debianFlaw) ? $this->setDebianFlaw($response->debianFlaw) : '';
+ isset($response->strength) ? $this->setStrength($response->strength) : '';
+ isset($response->q) ? $this->setQ($response->q) : '';
+
+ return ($this);
+ }
+} \ No newline at end of file
diff --git a/src/Objects/Protocol.php b/src/Objects/Protocol.php
new file mode 100644
index 0000000..b48f175
--- /dev/null
+++ b/src/Objects/Protocol.php
@@ -0,0 +1,11 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Objects;
+
+class Protocol
+{
+ private $id;
+ private $name;
+ private $version;
+ private $v2SuitesDisabled;
+ private $q;
+} \ No newline at end of file
diff --git a/src/Objects/SimClient.php b/src/Objects/SimClient.php
new file mode 100644
index 0000000..5c80e3d
--- /dev/null
+++ b/src/Objects/SimClient.php
@@ -0,0 +1,11 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Objects;
+
+class SimClient
+{
+ private $id;
+ private $name;
+ private $platform;
+ private $version;
+ private $isReference;
+} \ No newline at end of file
diff --git a/src/Objects/SimDetails.php b/src/Objects/SimDetails.php
new file mode 100644
index 0000000..f36ca0e
--- /dev/null
+++ b/src/Objects/SimDetails.php
@@ -0,0 +1,7 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Objects;
+
+class SimDetails
+{
+ private $results = array();
+} \ No newline at end of file
diff --git a/src/Objects/StatusCodes.php b/src/Objects/StatusCodes.php
new file mode 100644
index 0000000..bf69976
--- /dev/null
+++ b/src/Objects/StatusCodes.php
@@ -0,0 +1,7 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Objects;
+
+class StatusCodes
+{
+ private $statusDetails;
+} \ No newline at end of file
diff --git a/src/Objects/Suite.php b/src/Objects/Suite.php
new file mode 100644
index 0000000..3c265b7
--- /dev/null
+++ b/src/Objects/Suite.php
@@ -0,0 +1,16 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Objects;
+
+class Suite
+{
+ private $id;
+ private $name;
+ private $cipherStrength;
+ private $dhStrength;
+ private $dhP;
+ private $dhG;
+ private $dhYs;
+ private $ecdhBits;
+ private $ecdhStrength;
+ private $q;
+} \ No newline at end of file
diff --git a/src/Objects/Suites.php b/src/Objects/Suites.php
new file mode 100644
index 0000000..e6758df
--- /dev/null
+++ b/src/Objects/Suites.php
@@ -0,0 +1,8 @@
+<?php
+namespace BjoernrDe\SSLLabsApi\Objects;
+
+class Suites
+{
+ private $list = array();
+ private $preference;
+} \ No newline at end of file