Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
LoginToken
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getUserId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * Login Token Exception
5 *
6 * PHP version 8
7 *
8 * Copyright (C) The National Library of Finland 2023.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2,
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 *
23 * @category VuFind
24 * @package  Exceptions
25 * @author   Jaro Ravila <jaro.ravila@helsinki.fi>
26 * @license  https://opensource.org/licenses/gpl-2.0.php GNU General Public License
27 * @link     https://vufind.org/wiki/development Wiki
28 */
29
30declare(strict_types=1);
31
32namespace VuFind\Exception;
33
34/**
35 * Login Token Exception
36 *
37 * @category VuFind
38 * @package  Exceptions
39 * @author   Jaro Ravila <jaro.ravila@helsinki.fi>
40 * @license  https://opensource.org/licenses/gpl-2.0.php GNU General Public License
41 * @link     https://vufind.org/wiki/development Wiki
42 */
43class LoginToken extends \Exception
44{
45    /**
46     * Constructor
47     *
48     * @param string          $message  Exception message
49     * @param int             $userId   User ID
50     * @param \Throwable|null $previous Previous exception
51     */
52    public function __construct(
53        string $message,
54        protected int $userId,
55        ?\Throwable $previous = null
56    ) {
57        parent::__construct($message, 0, $previous);
58    }
59
60    /**
61     * Get the associated user ID
62     *
63     * @return int
64     */
65    public function getUserId(): int
66    {
67        return $this->userId;
68    }
69}