Skip to content

Commit 3212c89

Browse files
authored
Merge pull request #309 from stof/clean_settings
Remove dead code in the setting management
2 parents fe964b3 + a76625e commit 3212c89

2 files changed

Lines changed: 7 additions & 19 deletions

File tree

src/Saml2/Auth.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ class Auth
153153
/**
154154
* Initializes the SP SAML instance.
155155
*
156-
* @param array|object|null $oldSettings Setting data (You can provide a OneLogin\Saml\Settings, the settings object of the Saml folder implementation)
156+
* @param array|null $settings Setting data
157157
*/
158-
public function __construct($oldSettings = null)
158+
public function __construct(array $settings = null)
159159
{
160-
$this->_settings = new Settings($oldSettings);
160+
$this->_settings = new Settings($settings);
161161
}
162162

163163
/**

src/Saml2/Settings.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ class Settings
116116
* - Sets the paths of the different folders
117117
* - Loads settings info from settings file or array/object provided
118118
*
119-
* @param array|object|null $settings SAML Toolkit Settings
120-
* @param bool $spValidationOnly Validate or not the IdP data
119+
* @param array|null $settings SAML Toolkit Settings
120+
* @param bool $spValidationOnly Validate or not the IdP data
121121
*
122122
* @throws Error If any settings parameter is invalid
123123
* @throws Exception If Settings is incorrectly supplied
124124
*/
125-
public function __construct($settings = null, $spValidationOnly = false)
125+
public function __construct(array $settings = null, $spValidationOnly = false)
126126
{
127127
$this->_spValidationOnly = $spValidationOnly;
128128
$this->_loadPaths();
@@ -136,26 +136,14 @@ public function __construct($settings = null, $spValidationOnly = false)
136136
);
137137
}
138138
$this->_addDefaultValues();
139-
} else if (is_array($settings)) {
139+
} else {
140140
if (!$this->_loadSettingsFromArray($settings)) {
141141
throw new Error(
142142
'Invalid array settings: %s',
143143
Error::SETTINGS_INVALID,
144144
array(implode(', ', $this->_errors))
145145
);
146146
}
147-
} else if ($settings instanceof \Settings) {
148-
throw new Error(
149-
'Only OneLogin\Saml\Settings objects are supported.',
150-
Error::UNSUPPORTED_SETTINGS_OBJECT,
151-
array(implode(', ', $this->_errors))
152-
);
153-
} else {
154-
throw new Error(
155-
'Invalid array settings: %s',
156-
Error::SETTINGS_INVALID,
157-
array(implode(', ', $this->_errors))
158-
);
159147
}
160148

161149
$this->formatIdPCert();

0 commit comments

Comments
 (0)