Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
TranslatedException
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
1<?php declare(strict_types=1);
2/**
3 * PrivateBin
4 *
5 * a zero-knowledge paste bin
6 *
7 * @link      https://github.com/PrivateBin/PrivateBin
8 * @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
9 * @license   https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
10 */
11
12namespace PrivateBin\Exception;
13
14use Exception;
15use PrivateBin\I18n;
16
17/**
18 * TranslatedException
19 *
20 * An Exception that translates it's message.
21 */
22class TranslatedException extends Exception
23{
24    /**
25     * Translating exception constructor with mandatory messageId.
26     *
27     * @access public
28     * @param  string|array $messageId message ID or array of message ID and parameters
29     * @param  int $code
30     */
31    public function __construct($messageId, int $code = 0)
32    {
33        $message = is_string($messageId) ? I18n::translate($messageId) : forward_static_call_array('PrivateBin\I18n::translate', $messageId);
34        parent::__construct($message, $code);
35    }
36}