<commit_before><?php

/**
 * SAML 2 Logout Request
 *
 */
class OneLogin_Saml2_LogoutRequest
{
    /**
     * Object that represents the setting info
     * @var OneLogin_Saml2_Settings
     */
    protected $_settings;

    /**
     * SAML Logout Request
     * @var string
     */
    private $_logoutRequest;

    /**
    * After execute a validation process, this var contains the cause
    * @var string
    */
    private $_error;

    /**
     * Constructs the Logout Request object.
     *
     * @param OneLogin_Saml2_Settings $settings Settings
     * @param string                  $response A UUEncoded Logout Request.
     * @param string                  $session  The SessionIndex (taken from the SAML Response in the SSO process).
     *
     */
    public function __construct(OneLogin_Saml2_Settings $settings, $request = null, $sessionIndex = null)
    {

        $this->_settings = $settings;

        if (!isset($request) || empty($request)) {

            $spData = $this->_settings->getSPData();
            $idpData = $this->_settings->getIdPData();
            $security = $this->_settings->getSecurityData();

            $id = OneLogin_Saml2_Utils::generateUniqueID();
            $nameIdValue = OneLogin_Saml2_Utils::generateUniqueID();
            $issueInstant = OneLogin_Saml2_Utils::parseTime2SAML(time());
            
            $key = null;
            if (isset($security['nameIdEncrypted']) && $security['nameIdEncrypted']) {
                $key = $idpData['x509cert'];
            }

            $nameId = OneLogin_Saml2_Utils::generateNameId(
                $nameIdValue,
                $spData['entityId'],
                $spData['NameIDFormat'],
                $key
            );

            $sessionIndexStr = isset($sessionIndex) ? "<samlp:SessionIndex>{$sessionIndex}</samlp:SessionIndex>" : "";

            $logoutRequest = <<<LOGOUTREQUEST
<samlp:LogoutRequest
    xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
    xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
    ID="{$id}"<commit_msg>Update LogoutRequest.php<commit_after><?php

/**
 * SAML 2 Logout Request
 *
 */
class OneLogin_Saml2_LogoutRequest
{
    /**
     * Object that represents the setting info
     * @var OneLogin_Saml2_Settings
     */
    protected $_settings;

    /**
     * SAML Logout Request
     * @var string
     */
    private $_logoutRequest;

    /**
    * After execute a validation process, this var contains the cause
    * @var string
    */
    private $_error;

    /**
     * Constructs the Logout Request object.
     *
     * @param OneLogin_Saml2_Settings $settings Settings
     * @param string                  $response A UUEncoded Logout Request.
     * @param string                  $session  The SessionIndex (taken from the SAML Response in the SSO process).
     *
     */
    public function __construct(OneLogin_Saml2_Settings $settings, $request = null, $sessionIndex = null)
    {

        $this->_settings = $settings;

        if (!isset($request) || empty($request)) {

            $spData = $this->_settings->getSPData();
            $idpData = $this->_settings->getIdPData();
            $security = $this->_settings->getSecurityData();

            $id = OneLogin_Saml2_Utils::generateUniqueID();
            $nameIdValue = OneLogin_Saml2_Utils::generateUniqueID();
            $issueInstant = OneLogin_Saml2_Utils::parseTime2SAML(time());
            
            $cert = null;
            if (isset($security['nameIdEncrypted']) && $security['nameIdEncrypted']) {
                $cert = $idpData['x509cert'];
            }

            $nameId = OneLogin_Saml2_Utils::generateNameId(
                $nameIdValue,
                $spData['entityId'],
                $spData['NameIDFormat'],
                $cert
            );

            $sessionIndexStr = isset($sessionIndex) ? "<samlp:SessionIndex>{$sessionIndex}</samlp:SessionIndex>" : "";

            $logoutRequest = <<<LOGOUTREQUEST
<samlp:LogoutRequest
    xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
    xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
    ID="{$id}"
{'fraction_non_alphanumeric': 0.12408936376881982, 'fraction_numerical': 0.00825643516270034, 'mean_word_length': 2.28731045490822, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3367061', 'n_tokens_mistral': 1242, 'n_tokens_neox': 1201, 'n_words': 230}