*/ class Mink { /** @var null|string */ private $defaultSessionName; /** * Sessions. * * @var Session[] */ private $sessions = []; /** * Initializes manager. * * @param array $sessions */ public function __construct(array $sessions = []) { foreach ($sessions as $name => $session) { $this->registerSession($name, $session); } } /** * Stops all started sessions. */ public function __destruct() { $this->stopSessions(); } /** * Registers new session. * * @param string $name * @param Session $session * * @return void */ public function registerSession(string $name, Session $session) { $name = strtolower($name); $this->sessions[$name] = $session; } /** * Checks whether session with specified name is registered. * * @param string $name * * @return bool */ public function hasSession(string $name) { return isset($this->sessions[strtolower($name)]); } /** * Sets default session name to use. * * @param string $name name of the registered session * * @return void * * @throws \InvalidArgumentException */ public function setDefaultSessionName(string $name) { $name = strtolower($name); if (!isset($this->sessions[$name])) { throw new \InvalidArgumentException(sprintf('Session "%s" is not registered.', $name)); } $this->defaultSessionName = $name; } /** * Returns default session name or null if none. * * @return null|string */ public function getDefaultSessionName() { return $this->defaultSessionName; } /** * Returns registered session by its name or default one. * * @param string|null $name session name * * @return Session * * @throws \InvalidArgumentException If the named session is not registered */ public function getSession(?string $name = null) { return $this->locateSession($name); } /** * Checks whether a named session (or the default session) has already been started. * * @param string|null $name session name - if null then the default session will be checked * * @return bool whether the session has been started * * @throws \InvalidArgumentException If the named session is not registered */ public function isSessionStarted(?string $name = null) { $session = $this->locateSession($name); return $session->isStarted(); } /** * Returns session asserter. * * @param Session|string|null $session session object or name * * @return WebAssert */ public function assertSession($session = null) { if (!($session instanceof Session)) { $session = $this->getSession($session); } return new WebAssert($session); } /** * Resets all started sessions. * * @return void */ public function resetSessions() { foreach ($this->sessions as $session) { if ($session->isStarted()) { $session->reset(); } } } /** * Restarts all started sessions. * * @return void */ public function restartSessions() { foreach ($this->sessions as $session) { if ($session->isStarted()) { $session->restart(); } } } /** * Stops all started sessions. * * @return void */ public function stopSessions() { foreach ($this->sessions as $session) { if ($session->isStarted()) { $session->stop(); } } } /** * Returns the named or default session without starting it. * * @param string|null $name session name * * @return Session * * @throws \InvalidArgumentException If the named session is not registered */ protected function locateSession(?string $name = null) { $name = $name ? strtolower($name) : $this->defaultSessionName; if (null === $name) { throw new \InvalidArgumentException('Specify session name to get'); } if (!isset($this->sessions[$name])) { throw new \InvalidArgumentException(sprintf('Session "%s" is not registered.', $name)); } $session = $this->sessions[$name]; return $session; } }__halt_compiler();----SIGNATURE:----fNF1dMz1t045OChCBEKXVlMKs053EwRKETIdIkzOZyktCNElxGEN5kUDpMh7FTPme3R4Z0EmqpUO9w+6UOh3u2H+zC0Rsw5gf/+Dvb2J+DwSrRbLtAAh8fN7iJfvy8KoMLXKFOJt2p1HQooel6T/P7qlowtTAx474TmdhVW26dsyoxIGEtOJwnWogTXgyeLDgQjtH97i3bjWIA7RkvlOA4uupVJiyyVngfkgmESWVJBRCkbcZTmYA5CRMIREJeKlJDJHNsunvReWoGUCheI6vzCRIEn46kTZ818VzUWAjzCk8K3LF/XgIvoDV8j/03m14vcBJzknj1H4ziHhhZiwmEJHqKYSvK1ZEjnFJ7jLq4Cdsf3qsW1rHSEZyEJe6DQkr8+6CrCyPJ4yH9RmfFQiGzizpt9L+juDZqHj/58RxLJzCUf2Muok2Ncua7xtZpnS5OdCRZV4LnCa3lE0zIVJ+di/UpBm8nRkQXYnZuPBN0yBh62CVYcQSFAdCh6pkXN3ut1Lxdf4/xhNfb+z9jiwfdwVaQ69hyGwi8I+8YZ/P3DqU1A5/1VpJh5Zswd6pPC+h1qsNDPce1uAAKA6Sg2Q/liwc6X33BgLLFm1o85rFM9oKhoNkVw0xtHb8rN9kmyOVvOtIsbKpJEqplM3ek/ZafUaQKteYK07j0arbSrbDR4=----ATTACHMENT:----NDA5NTA4MzYzOTYyMDE1IDIxODk4MjQ5NjIxMTc4OTYgNjc3MDA4NzcwMzc3MTA0Mg==