Commit 561e3255 authored by Jérémy Jaouen's avatar Jérémy Jaouen
Browse files

set default value in constructor

parent 259705e3
......@@ -130,11 +130,11 @@ class OpenIdConfiguration implements ProviderConfigurationInterface
* @throws OpenIdConfigurationException
*/
public function __construct(
private ?ContactTemplate $contactTemplate,
private bool $isAutoImportEnabled,
private ?string $emailBindAttribute,
private ?string $userAliasBindAttribute,
private ?string $userNameBindAttribute,
private ?ContactTemplate $contactTemplate = null,
private ?string $emailBindAttribute = null,
private ?string $userAliasBindAttribute = null,
private ?string $userNameBindAttribute = null,
) {
if ($isAutoImportEnabled === true) {
$missingMandatoryParameters = [];
......
......@@ -46,8 +46,8 @@ class OpenIdConfigurationFactory
: null;
$configuration = new OpenIdConfiguration(
$contactTemplate,
$request->isAutoImportEnabled,
$contactTemplate,
$request->emailBindAttribute,
$request->userAliasBindAttribute,
$request->userNameBindAttribute
......
......@@ -36,10 +36,10 @@ class DbOpenIdConfigurationFactory
public static function createFromRecord(array $record, array $customConfiguration): OpenIdConfiguration
{
$configuration = new OpenIdConfiguration(
$customConfiguration['auto_import'] === '1',
$customConfiguration['contact_template'] !== null
? self::createContactTemplate($customConfiguration['contact_template'])
: null,
$customConfiguration['auto_import'] === '1',
$customConfiguration['email_bind_attribute'],
$customConfiguration['alias_bind_attribute'],
$customConfiguration['fullname_bind_attribute']
......
......@@ -41,8 +41,8 @@ beforeEach(function () {
it('should present a provider configuration', function () {
$configuration = new OpenIdConfiguration(
new ContactTemplate(1, 'contact_template'),
false,
new ContactTemplate(1, 'contact_template'),
null,
null,
null,
......
......@@ -73,8 +73,8 @@ beforeEach(function () {
$this->authenticationTokens = $this->createMock(AuthenticationTokens::class);
$this->validOpenIdConfiguration = new OpenIdConfiguration(
new ContactTemplate(1, 'contact_template'),
false,
new ContactTemplate(1, 'contact_template'),
null,
null,
null,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment