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

Commit eb58bba

Browse files
authored
Merge pull request #3 from ampaze/master
Change private to protected to make inheritance useable
2 parents d2b7341 + f337027 commit eb58bba

8 files changed

+70
-70
lines changed

src/DNSValidator/DNSOverHTTPS.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ class DNSOverHTTPS implements DNSValidatorInterface
4848
*
4949
* @var null|string
5050
*/
51-
private $baseURI;
51+
protected $baseURI;
5252

5353
/**
5454
* Guzzle client handler
5555
*
5656
* @var Client object
5757
*/
58-
private $client;
58+
protected $client;
5959

6060
/**
6161
* DNSOverHTTPS constructor.

src/DiagnosticLogger.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
class DiagnosticLogger extends AbstractLogger
1515
{
16-
private $logs = [];
16+
protected $logs = [];
1717

1818
public function log($level, $message, array $context = [])
1919
{
@@ -63,7 +63,7 @@ public function dumpHTML($echo = true)
6363
/**
6464
* Interpolates context values into the message placeholders.
6565
*/
66-
private function interpolateMessage($message, array $context = [])
66+
protected function interpolateMessage($message, array $context = [])
6767
{
6868
// build a replacement array with braces around the context keys
6969
$replace = [];

src/FilesystemCertificateStorage.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
class FilesystemCertificateStorage implements CertificateStorageInterface
1212
{
13-
private $dir;
13+
protected $dir;
1414

1515
public function __construct($dir = null)
1616
{
@@ -57,7 +57,7 @@ public function setAccountPrivateKey($key)
5757
$this->setMetadata('account.key', $key);
5858
}
5959

60-
private function getDomainKey($domain, $suffix)
60+
protected function getDomainKey($domain, $suffix)
6161
{
6262
return str_replace('*', 'wildcard', $domain).'.'.$suffix;
6363
}
@@ -125,7 +125,7 @@ public function setPublicKey($domain, $key)
125125
$this->setMetadata($this->getDomainKey($domain, 'public'), $key);
126126
}
127127

128-
private function getMetadataFilename($key)
128+
protected function getMetadataFilename($key)
129129
{
130130
$key=str_replace('*', 'wildcard', $key);
131131
$file=$this->dir.DIRECTORY_SEPARATOR.$key;

src/LEAccount.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
class LEAccount
1616
{
17-
private $connector;
17+
protected $connector;
1818

1919
public $id;
2020
public $key;
@@ -25,10 +25,10 @@ class LEAccount
2525
public $status;
2626

2727
/** @var LoggerInterface */
28-
private $log;
28+
protected $log;
2929

3030
/** @var CertificateStorageInterface */
31-
private $storage;
31+
protected $storage;
3232

3333
/**
3434
* Initiates the LetsEncrypt Account class.
@@ -69,7 +69,7 @@ public function __construct($connector, LoggerInterface $log, $email, Certificat
6969
*
7070
* @return string|bool Returns the new account URL when the account was successfully created, false if not.
7171
*/
72-
private function createLEAccount($email)
72+
protected function createLEAccount($email)
7373
{
7474
$contact = array_map(function ($addr) {
7575
return empty($addr) ? '' : (strpos($addr, 'mailto') === false ? 'mailto:' . $addr : $addr);
@@ -95,7 +95,7 @@ private function createLEAccount($email)
9595
*
9696
* @return string|bool Returns the account URL if it is found, or false when none is found.
9797
*/
98-
private function getLEAccount()
98+
protected function getLEAccount()
9999
{
100100
$sign = $this->connector->signRequestJWK(['onlyReturnExisting' => true], $this->connector->newAccount);
101101
$post = $this->connector->post($this->connector->newAccount, $sign);
@@ -111,7 +111,7 @@ private function getLEAccount()
111111
/**
112112
* Gets the LetsEncrypt account data from the account URL.
113113
*/
114-
private function getLEAccountData()
114+
protected function getLEAccountData()
115115
{
116116
$sign = $this->connector->signRequestKid(
117117
['' => ''],

src/LEAuthorization.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
*/
1414
class LEAuthorization
1515
{
16-
private $connector;
17-
16+
protected $connector;
17+
1818
public $authorizationURL;
1919
public $identifier;
2020
public $status;
2121
public $expires;
2222
public $challenges;
2323

2424
/** @var LoggerInterface */
25-
private $log;
26-
25+
protected $log;
26+
2727
/**
2828
* Initiates the LetsEncrypt Authorization class. Child of a LetsEncrypt Order instance.
2929
*
@@ -49,11 +49,11 @@ public function __construct($connector, LoggerInterface $log, $authorizationURL)
4949
//@codeCoverageIgnoreEnd
5050
}
5151
}
52-
52+
5353
/**
5454
* Updates the data associated with the current LetsEncrypt Authorization instance.
5555
*/
56-
56+
5757
public function updateData()
5858
{
5959
$get = $this->connector->get($this->authorizationURL);
@@ -68,7 +68,7 @@ public function updateData()
6868
//@codeCoverageIgnoreEnd
6969
}
7070
}
71-
71+
7272
/**
7373
* Gets the challenge of the given $type for this LetsEncrypt Authorization instance.
7474
* Throws a Runtime Exception if the given $type is not found in this LetsEncrypt Authorization instance.

src/LEClient.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,30 @@ class LEClient
2525
const LE_STAGING = 'https://acme-staging-v02.api.letsencrypt.org';
2626

2727
/** @var LEConnector */
28-
private $connector;
28+
protected $connector;
2929

3030
/** @var LEAccount */
31-
private $account;
31+
protected $account;
3232

33-
private $baseURL;
33+
protected $baseURL;
3434

3535
/** @var LoggerInterface */
36-
private $log;
36+
protected $log;
3737

3838
/** @var ClientInterface */
39-
private $httpClient;
39+
protected $httpClient;
4040

4141
/** @var DNSValidatorInterface */
42-
private $dns;
42+
protected $dns;
4343

4444
/** @var Sleep */
45-
private $sleep;
45+
protected $sleep;
4646

4747
/** @var CertificateStorageInterface */
48-
private $storage;
48+
protected $storage;
4949

5050

51-
private $email;
51+
protected $email;
5252

5353
/**
5454
* Initiates the LetsEncrypt main client.
@@ -87,7 +87,7 @@ public function __construct(
8787
$this->email = $email;
8888
}
8989

90-
private function initBaseUrl($acmeURL)
90+
protected function initBaseUrl($acmeURL)
9191
{
9292
if (is_bool($acmeURL)) {
9393
$this->baseURL = $acmeURL ? LEClient::LE_STAGING : LEClient::LE_PRODUCTION;
@@ -121,7 +121,7 @@ public function setSleep(WaitInterface $sleep)
121121
$this->sleep = $sleep;
122122
}
123123

124-
private function getConnector()
124+
protected function getConnector()
125125
{
126126
if (!isset($this->connector)) {
127127
$this->connector = new LEConnector($this->log, $this->httpClient, $this->baseURL, $this->storage);

src/LEConnector.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class LEConnector
2323
{
2424
public $baseURL;
2525

26-
private $nonce;
26+
protected $nonce;
2727

2828
public $keyChange;
2929
public $newAccount;
@@ -35,13 +35,13 @@ class LEConnector
3535
public $accountDeactivated = false;
3636

3737
/** @var LoggerInterface */
38-
private $log;
38+
protected $log;
3939

4040
/** @var ClientInterface */
41-
private $httpClient;
41+
protected $httpClient;
4242

4343
/** @var CertificateStorageInterface */
44-
private $storage;
44+
protected $storage;
4545

4646
/**
4747
* Initiates the LetsEncrypt Connector class.
@@ -70,7 +70,7 @@ public function __construct(
7070
/**
7171
* Requests the LetsEncrypt Directory and stores the necessary URLs in this LetsEncrypt Connector instance.
7272
*/
73-
private function getLEDirectory()
73+
protected function getLEDirectory()
7474
{
7575
$req = $this->get('/directory');
7676
$this->keyChange = $req['body']['keyChange'];
@@ -83,7 +83,7 @@ private function getLEDirectory()
8383
/**
8484
* Requests a new nonce from the LetsEncrypt server and stores it in this LetsEncrypt Connector instance.
8585
*/
86-
private function getNewNonce()
86+
protected function getNewNonce()
8787
{
8888
$result = $this->head($this->newNonce);
8989

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

178-
private function formatResponse($method, $requestURL, ResponseInterface $response)
178+
protected function formatResponse($method, $requestURL, ResponseInterface $response)
179179
{
180180
$body = $response->getBody();
181181

@@ -210,7 +210,7 @@ private function formatResponse($method, $requestURL, ResponseInterface $respons
210210
return $jsonresponse;
211211
}
212212

213-
private function maintainNonce($requestMethod, ResponseInterface $response)
213+
protected function maintainNonce($requestMethod, ResponseInterface $response)
214214
{
215215
if ($response->hasHeader('Replay-Nonce')) {
216216
$this->nonce = $response->getHeader('Replay-Nonce')[0];

0 commit comments

Comments
 (0)