|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* CMS Pico - Create websites using Pico CMS for Nextcloud. |
|
4
|
|
|
* |
|
5
|
|
|
* @copyright Copyright (c) 2017, Maxence Lange (<[email protected]>) |
|
6
|
|
|
* @copyright Copyright (c) 2022, Daniel Rudolf (<[email protected]>) |
|
7
|
|
|
* |
|
8
|
|
|
* @license GNU AGPL version 3 or any later version |
|
9
|
|
|
* |
|
10
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
11
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
12
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
13
|
|
|
* License, or (at your option) any later version. |
|
14
|
|
|
* |
|
15
|
|
|
* This program is distributed in the hope that it will be useful, |
|
16
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18
|
|
|
* GNU Affero General Public License for more details. |
|
19
|
|
|
* |
|
20
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
21
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
22
|
|
|
*/ |
|
23
|
|
|
|
|
24
|
|
|
declare(strict_types=1); |
|
25
|
|
|
|
|
26
|
|
|
namespace OCA\CMSPico\Exceptions; |
|
27
|
|
|
|
|
28
|
|
|
class ThemeNotFoundException extends \Exception |
|
29
|
|
|
{ |
|
30
|
|
|
/** @var string|null */ |
|
31
|
|
|
private $themeName; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* ThemeNotFoundException constructor. |
|
35
|
|
|
* |
|
36
|
|
|
* @param string|null $themeName |
|
37
|
|
|
* @param \Exception|null $previous |
|
38
|
|
|
*/ |
|
39
|
|
|
public function __construct(string $themeName = null, \Exception $previous = null) |
|
40
|
|
|
{ |
|
41
|
|
|
$this->themeName = $themeName; |
|
42
|
|
|
|
|
43
|
|
|
$message = ''; |
|
44
|
|
|
if ($themeName) { |
|
45
|
|
|
$message = sprintf("Unable to load theme '%s': No such theme", $themeName); |
|
46
|
|
|
} elseif ($previous) { |
|
47
|
|
|
$message = $previous->getMessage(); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
if ($previous) { |
|
51
|
|
|
parent::__construct($message, $previous->getCode(), $previous); |
|
52
|
|
|
} else { |
|
53
|
|
|
parent::__construct($message); |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @return string|null |
|
59
|
|
|
*/ |
|
60
|
|
|
public function getThemeName(): ?string |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->themeName; |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|