wiki.techinc.nl/includes/session/SessionOverflowException.php
Daimona Eaytoy f3262ed390 Add a dedicated Exception for SessionOverflow
Instead of setting a custom property and checking via isset + count.

Change-Id: I087eeb2eee414218bbd6023ad1703fde22292281
2019-09-10 08:27:29 +00:00

34 lines
864 B
PHP

<?php
namespace MediaWiki\Session;
/**
* OverflowException specific to the SessionManager, used when the request had multiple possible
* sessions tied for top priority.
*
* @since 1.34
*/
class SessionOverflowException extends \OverflowException {
/** @var SessionInfo[] */
private $sessionInfos;
/**
* @param SessionInfo[] $sessionInfos Must have at least two elements
* @param string $msg
* @throws \InvalidArgumentException If $sessionInfos has less than 2 elements
*/
function __construct( array $sessionInfos, $msg ) {
if ( count( $sessionInfos ) < 2 ) {
throw new \InvalidArgumentException( 'Expected at least two SessionInfo objects.' );
}
parent::__construct( $msg );
$this->sessionInfos = $sessionInfos;
}
/**
* @return SessionInfo[]
*/
public function getSessionInfos() : array {
return $this->sessionInfos;
}
}