Skip to content

Commit ea86ace

Browse files
committed
🚿 OAuthStorageAbstract: remove pseudo constructor
1 parent 3bce05c commit ea86ace

File tree

3 files changed

+13
-22
lines changed

3 files changed

+13
-22
lines changed

src/Storage/FileStorage.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,9 @@ public function __construct(
4646
OAuthOptions|SettingsContainerInterface $options = new OAuthOptions,
4747
LoggerInterface $logger = new NullLogger
4848
){
49-
$this->oauthUser = $oauthUser;
50-
5149
parent::__construct($options, $logger);
52-
}
5350

54-
/**
55-
* @inheritDoc
56-
*/
57-
protected function construct():void{
58-
$this->oauthUser = trim((string)$this->oauthUser);
51+
$this->oauthUser = trim((string)$oauthUser);
5952

6053
if($this->oauthUser === ''){
6154
throw new OAuthStorageException('invalid OAuth user');

src/Storage/OAuthStorageAbstract.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,13 @@ public function __construct(
5050
OAuthOptions|SettingsContainerInterface $options = new OAuthOptions,
5151
LoggerInterface $logger = new NullLogger
5252
){
53+
$this->options = $options;
54+
$this->logger = $logger;
5355

5456
if($this->options->useStorageEncryption === true && empty($this->options->storageEncryptionKey)){
5557
throw new OAuthStorageException('no encryption key given');
5658
}
5759

58-
$this->options = $options;
59-
$this->logger = $logger;
60-
61-
$this->construct();
62-
}
63-
64-
/**
65-
* A replacement constructor that you can call in extended classes,
66-
* so that you don't have to implement the monstrous original `__construct()`
67-
*/
68-
protected function construct():void{
69-
// noop
7060
}
7161

7262
/**

src/Storage/SessionStorage.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111

1212
namespace chillerlan\OAuth\Storage;
1313

14+
use chillerlan\OAuth\OAuthOptions;
1415
use chillerlan\OAuth\Core\AccessToken;
16+
use chillerlan\Settings\SettingsContainerInterface;
17+
use Psr\Log\{LoggerInterface, NullLogger};
1518
use function session_start, session_status, session_write_close;
1619
use const PHP_SESSION_ACTIVE, PHP_SESSION_DISABLED;
1720

@@ -28,9 +31,14 @@ class SessionStorage extends OAuthStorageAbstract{
2831
protected string $storageVar;
2932

3033
/**
31-
* SessionStorage (pseudo-) constructor.
34+
* @inheritDoc
3235
*/
33-
public function construct():void{
36+
public function __construct(
37+
OAuthOptions|SettingsContainerInterface $options = new OAuthOptions,
38+
LoggerInterface $logger = new NullLogger
39+
){
40+
parent::__construct($options, $logger);
41+
3442
$this->storageVar = $this->options->sessionStorageVar;
3543

3644
// Determine if the session has started.

0 commit comments

Comments
 (0)