Skip to content
This repository has been archived by the owner on Oct 13, 2020. It is now read-only.

Commit

Permalink
Merge pull request #3 from ampaze/master
Browse files Browse the repository at this point in the history
Change private to protected to make inheritance useable
  • Loading branch information
ptrstovka committed Feb 26, 2020
2 parents d2b7341 + f337027 commit eb58bba
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 70 deletions.
4 changes: 2 additions & 2 deletions src/DNSValidator/DNSOverHTTPS.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ class DNSOverHTTPS implements DNSValidatorInterface
*
* @var null|string
*/
private $baseURI;
protected $baseURI;

/**
* Guzzle client handler
*
* @var Client object
*/
private $client;
protected $client;

/**
* DNSOverHTTPS constructor.
Expand Down
4 changes: 2 additions & 2 deletions src/DiagnosticLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
class DiagnosticLogger extends AbstractLogger
{
private $logs = [];
protected $logs = [];

public function log($level, $message, array $context = [])
{
Expand Down Expand Up @@ -63,7 +63,7 @@ public function dumpHTML($echo = true)
/**
* Interpolates context values into the message placeholders.
*/
private function interpolateMessage($message, array $context = [])
protected function interpolateMessage($message, array $context = [])
{
// build a replacement array with braces around the context keys
$replace = [];
Expand Down
6 changes: 3 additions & 3 deletions src/FilesystemCertificateStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class FilesystemCertificateStorage implements CertificateStorageInterface
{
private $dir;
protected $dir;

public function __construct($dir = null)
{
Expand Down Expand Up @@ -57,7 +57,7 @@ public function setAccountPrivateKey($key)
$this->setMetadata('account.key', $key);
}

private function getDomainKey($domain, $suffix)
protected function getDomainKey($domain, $suffix)
{
return str_replace('*', 'wildcard', $domain).'.'.$suffix;
}
Expand Down Expand Up @@ -125,7 +125,7 @@ public function setPublicKey($domain, $key)
$this->setMetadata($this->getDomainKey($domain, 'public'), $key);
}

private function getMetadataFilename($key)
protected function getMetadataFilename($key)
{
$key=str_replace('*', 'wildcard', $key);
$file=$this->dir.DIRECTORY_SEPARATOR.$key;
Expand Down
12 changes: 6 additions & 6 deletions src/LEAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class LEAccount
{
private $connector;
protected $connector;

public $id;
public $key;
Expand All @@ -25,10 +25,10 @@ class LEAccount
public $status;

/** @var LoggerInterface */
private $log;
protected $log;

/** @var CertificateStorageInterface */
private $storage;
protected $storage;

/**
* Initiates the LetsEncrypt Account class.
Expand Down Expand Up @@ -69,7 +69,7 @@ public function __construct($connector, LoggerInterface $log, $email, Certificat
*
* @return string|bool Returns the new account URL when the account was successfully created, false if not.
*/
private function createLEAccount($email)
protected function createLEAccount($email)
{
$contact = array_map(function ($addr) {
return empty($addr) ? '' : (strpos($addr, 'mailto') === false ? 'mailto:' . $addr : $addr);
Expand All @@ -95,7 +95,7 @@ private function createLEAccount($email)
*
* @return string|bool Returns the account URL if it is found, or false when none is found.
*/
private function getLEAccount()
protected function getLEAccount()
{
$sign = $this->connector->signRequestJWK(['onlyReturnExisting' => true], $this->connector->newAccount);
$post = $this->connector->post($this->connector->newAccount, $sign);
Expand All @@ -111,7 +111,7 @@ private function getLEAccount()
/**
* Gets the LetsEncrypt account data from the account URL.
*/
private function getLEAccountData()
protected function getLEAccountData()
{
$sign = $this->connector->signRequestKid(
['' => ''],
Expand Down
14 changes: 7 additions & 7 deletions src/LEAuthorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
*/
class LEAuthorization
{
private $connector;
protected $connector;

public $authorizationURL;
public $identifier;
public $status;
public $expires;
public $challenges;

/** @var LoggerInterface */
private $log;
protected $log;

/**
* Initiates the LetsEncrypt Authorization class. Child of a LetsEncrypt Order instance.
*
Expand All @@ -49,11 +49,11 @@ public function __construct($connector, LoggerInterface $log, $authorizationURL)
//@codeCoverageIgnoreEnd
}
}

/**
* Updates the data associated with the current LetsEncrypt Authorization instance.
*/

public function updateData()
{
$get = $this->connector->get($this->authorizationURL);
Expand All @@ -68,7 +68,7 @@ public function updateData()
//@codeCoverageIgnoreEnd
}
}

/**
* Gets the challenge of the given $type for this LetsEncrypt Authorization instance.
* Throws a Runtime Exception if the given $type is not found in this LetsEncrypt Authorization instance.
Expand Down
22 changes: 11 additions & 11 deletions src/LEClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,30 @@ class LEClient
const LE_STAGING = 'https://acme-staging-v02.api.letsencrypt.org';

/** @var LEConnector */
private $connector;
protected $connector;

/** @var LEAccount */
private $account;
protected $account;

private $baseURL;
protected $baseURL;

/** @var LoggerInterface */
private $log;
protected $log;

/** @var ClientInterface */
private $httpClient;
protected $httpClient;

/** @var DNSValidatorInterface */
private $dns;
protected $dns;

/** @var Sleep */
private $sleep;
protected $sleep;

/** @var CertificateStorageInterface */
private $storage;
protected $storage;


private $email;
protected $email;

/**
* Initiates the LetsEncrypt main client.
Expand Down Expand Up @@ -87,7 +87,7 @@ public function __construct(
$this->email = $email;
}

private function initBaseUrl($acmeURL)
protected function initBaseUrl($acmeURL)
{
if (is_bool($acmeURL)) {
$this->baseURL = $acmeURL ? LEClient::LE_STAGING : LEClient::LE_PRODUCTION;
Expand Down Expand Up @@ -121,7 +121,7 @@ public function setSleep(WaitInterface $sleep)
$this->sleep = $sleep;
}

private function getConnector()
protected function getConnector()
{
if (!isset($this->connector)) {
$this->connector = new LEConnector($this->log, $this->httpClient, $this->baseURL, $this->storage);
Expand Down
18 changes: 9 additions & 9 deletions src/LEConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class LEConnector
{
public $baseURL;

private $nonce;
protected $nonce;

public $keyChange;
public $newAccount;
Expand All @@ -35,13 +35,13 @@ class LEConnector
public $accountDeactivated = false;

/** @var LoggerInterface */
private $log;
protected $log;

/** @var ClientInterface */
private $httpClient;
protected $httpClient;

/** @var CertificateStorageInterface */
private $storage;
protected $storage;

/**
* Initiates the LetsEncrypt Connector class.
Expand Down Expand Up @@ -70,7 +70,7 @@ public function __construct(
/**
* Requests the LetsEncrypt Directory and stores the necessary URLs in this LetsEncrypt Connector instance.
*/
private function getLEDirectory()
protected function getLEDirectory()
{
$req = $this->get('/directory');
$this->keyChange = $req['body']['keyChange'];
Expand All @@ -83,7 +83,7 @@ private function getLEDirectory()
/**
* Requests a new nonce from the LetsEncrypt server and stores it in this LetsEncrypt Connector instance.
*/
private function getNewNonce()
protected function getNewNonce()
{
$result = $this->head($this->newNonce);

Expand Down Expand Up @@ -133,7 +133,7 @@ public function checkHTTPChallenge($domain, $token, $keyAuthorization)
*
* @return array Returns an array with the keys 'request', 'header' and 'body'.
*/
private function request($method, $URL, $data = null)
protected function request($method, $URL, $data = null)
{
if ($this->accountDeactivated) {
throw new LogicException('The account was deactivated. No further requests can be made.');
Expand Down Expand Up @@ -175,7 +175,7 @@ private function request($method, $URL, $data = null)
return $this->formatResponse($method, $requestURL, $response);
}

private function formatResponse($method, $requestURL, ResponseInterface $response)
protected function formatResponse($method, $requestURL, ResponseInterface $response)
{
$body = $response->getBody();

Expand Down Expand Up @@ -210,7 +210,7 @@ private function formatResponse($method, $requestURL, ResponseInterface $respons
return $jsonresponse;
}

private function maintainNonce($requestMethod, ResponseInterface $response)
protected function maintainNonce($requestMethod, ResponseInterface $response)
{
if ($response->hasHeader('Replay-Nonce')) {
$this->nonce = $response->getHeader('Replay-Nonce')[0];
Expand Down

0 comments on commit eb58bba

Please sign in to comment.