Debian Codegraph @

includes/session/SessionOverflowException.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Session;
4
5 use InvalidArgumentException;
6
7 /**
8 * OverflowException specific to the SessionManager, used when the request had multiple possible
9 * sessions tied for top priority.
10 *
11 * @since 1.34
12 */
13 class SessionOverflowException extends \OverflowException {
14 /** @var SessionInfo[] */
15 private $sessionInfos;
16
17 /**
18 * @param SessionInfo[] $sessionInfos Must have at least two elements
19 * @param string $msg
20 * @throws \InvalidArgumentException If $sessionInfos has less than 2 elements
21 */
22 public function __construct( array $sessionInfos, $msg ) {
23 if ( count( $sessionInfos ) < 2 ) {
24 throw new InvalidArgumentException( 'Expected at least two SessionInfo objects.' );
25 }
26 parent::__construct( $msg );
27 $this->sessionInfos = $sessionInfos;
28 }
29
30 /**
31 * @return SessionInfo[]
32 */
33 public function getSessionInfos(): array {
34 return $this->sessionInfos;
35 }
36 }