public function __construct($settings = null, $spValidationOnly = false)
{
$this->_spValidationOnly = $spValidationOnly;
$this->_loadPaths();
if (!isset($settings)) {
if (!$this->_loadSettingsFromFile()) {
throw new OneLogin_Saml2_Error('Invalid file settings: %s', OneLogin_Saml2_Error::SETTINGS_INVALID, array(implode(', ', $this->_errors)));
}
$this->_addDefaultValues();
} else {
if (is_array($settings)) {
if (!$this->_loadSettingsFromArray($settings)) {
throw new OneLogin_Saml2_Error('Invalid array settings: %s', OneLogin_Saml2_Error::SETTINGS_INVALID, array(implode(', ', $this->_errors)));
}
} else {
if ($settings instanceof OneLogin_Saml2_Settings) {
throw new Exception('Only instances of OneLogin_Saml_Settings are supported.');
} else {
if (!$this->_loadSettingsFromArray($settings->getValues())) {
throw new OneLogin_Saml2_Error('Invalid array settings: %s', OneLogin_Saml2_Error::SETTINGS_INVALID, array(implode(', ', $this->_errors)));
}
}
}
}
$this->formatIdPCert();
$this->formatSPCert();
$this->formatSPKey();
}