Skip to content

Commit bfcab29

Browse files
committed
make repositoryFactory configurable so we can plug in our own
1 parent f5fa894 commit bfcab29

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Factory/AuthorizationServerFactory.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,21 @@ class AuthorizationServerFactory
1414
/** @var Config */
1515
private $config;
1616

17+
/** @var RepositoryFactory */
18+
private $repositoryFactory;
19+
1720
//////////////////////////////// PUBLIC API \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1821

1922
final public function __construct(Config $config)
2023
{
2124
$this->config = $config;
2225
}
2326

27+
final public function setRepositoryFactory(RepositoryFactory $repositoryFactory)
28+
{
29+
$this->repositoryFactory = $repositoryFactory;
30+
}
31+
2432
final public function create() : AuthorizationServer
2533
{
2634
$config = $this->config;
@@ -30,7 +38,7 @@ final public function create() : AuthorizationServer
3038
$grantTypes = $config->getGrantTypes();
3139
$keys = $config->getKeys();
3240

33-
$repositoryFactory = new RepositoryFactory([
41+
$repositoryFactory = $this->repositoryFactory ?? new RepositoryFactory([
3442
Repository::CLIENT => new Client(
3543
$client->getIdentifier(),
3644
$client->getSecret(),

0 commit comments

Comments
 (0)