xref: /plugin/dw2pdf/src/ExportException.php (revision 4c5691130dbf9035b960f10f5b3cb4b319a026d8)
1<?php
2
3namespace dokuwiki\plugin\dw2pdf\src;
4
5/**
6 * Signals an expected, user-facing failure during PDF export
7 *
8 * The exception message is a language key. Optional arguments are applied to the
9 * translated string via vsprintf(), allowing the message to be localized where it
10 * is displayed to the user.
11 */
12class ExportException extends \Exception
13{
14    /** @var array Arguments to fill placeholders in the translated message */
15    protected array $args;
16
17    /**
18     * @param string $langKey Language key describing the failure
19     * @param array $args Arguments applied to the translated string via vsprintf()
20     */
21    public function __construct(string $langKey, array $args = [])
22    {
23        parent::__construct($langKey);
24        $this->args = $args;
25    }
26
27    /**
28     * Get the arguments to fill placeholders in the translated message
29     *
30     * @return array
31     */
32    public function getArgs(): array
33    {
34        return $this->args;
35    }
36}
37