SessionOverflowException.php 864 B

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