CoreFiles by mySites.guru
SessionManager.php74 lines, 1,618 bytes, from Joomla_4.2.0-Stable-Full_Package.zip
Raw History Compare with 4.1.5
md5
7c222addb036da1c57d74558380a02b3
sha1
e2855fbaff26cb16cac1e57555ddca39c359fb69
sha256
1b1a58a9dc3d1b005fe21a88fb272622c3bf2cddb9a63f7d02f0866f448be2b5
<?php

/**
 * Joomla! Content Management System
 *
 * @copyright  Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS\Session;

/**
 * Manager for interacting with the session handler to perform updates on sessions.
 *
 * @since  4.0.0
 */
final class SessionManager
{
    /**
     * Session handler.
     *
     * @var    \SessionHandlerInterface
     * @since  4.0.0
     */
    private $sessionHandler;

    /**
     * SessionManager constructor.
     *
     * @param   \SessionHandlerInterface  $sessionHandler  Session handler.
     *
     * @since   4.0.0
     */
    public function __construct(\SessionHandlerInterface $sessionHandler)
    {
        $this->sessionHandler = $sessionHandler;
    }

    /**
     * Destroys the given session ID.
     *
     * @param   string  $sessionId  The session ID to destroy.
     *
     * @return  boolean
     *
     * @since   4.0.0
     */
    public function destroySession(string $sessionId): bool
    {
        return $this->sessionHandler->destroy($sessionId);
    }

    /**
     * Destroys the given session IDs.
     *
     * @param   string[]  $sessionIds  The session IDs to destroy.
     *
     * @return  boolean
     *
     * @since   4.0.0
     */
    public function destroySessions(array $sessionIds): bool
    {
        $result = true;

        foreach ($sessionIds as $sessionId) {
            if (!$this->destroySession($sessionId)) {
                $result = false;
            }
        }

        return $result;
    }
}

The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.