1 | <?php |
||
24 | class ThemeService implements IThemeService { |
||
25 | |||
26 | const DEFAULT_THEME_PATH = '/themes/default'; |
||
27 | |||
28 | /** |
||
29 | * @var Theme |
||
30 | */ |
||
31 | private $theme; |
||
32 | |||
33 | /** @var string */ |
||
34 | private $defaultThemeDirectory; |
||
35 | |||
36 | /** |
||
37 | * ThemeService constructor. |
||
38 | * |
||
39 | * @param string $themeName |
||
40 | */ |
||
41 | public function __construct($themeName = '') { |
||
50 | |||
51 | /** |
||
52 | * @return bool |
||
53 | */ |
||
54 | public function defaultThemeExists() { |
||
57 | |||
58 | /** |
||
59 | * @return Theme |
||
60 | */ |
||
61 | public function getTheme() { |
||
64 | |||
65 | /** |
||
66 | * @param string $themeName |
||
67 | */ |
||
68 | public function setAppTheme($themeName = '') { |
||
71 | |||
72 | /** |
||
73 | * @param string $themeName |
||
74 | * @param bool $appTheme |
||
75 | * @param Theme $theme |
||
76 | * @return Theme |
||
77 | */ |
||
78 | private function makeTheme($themeName, $appTheme = true, Theme $theme = null) { |
||
96 | |||
97 | /** |
||
98 | * @param string $themeName |
||
99 | * @param bool $appTheme |
||
100 | * @return string |
||
101 | */ |
||
102 | private function getDirectory($themeName, $appTheme = true) { |
||
112 | |||
113 | /** |
||
114 | * @param $themeName |
||
115 | * @param bool $appTheme |
||
116 | * @return false|string |
||
117 | */ |
||
118 | private function getWebPath($themeName, $appTheme = true) { |
||
129 | |||
130 | /** |
||
131 | * @return Theme[] |
||
132 | */ |
||
133 | public function getAllThemes() { |
||
136 | |||
137 | /** |
||
138 | * @return Theme[] |
||
139 | */ |
||
140 | private function getAllAppThemes() { |
||
149 | |||
150 | /** |
||
151 | * @return Theme[] |
||
152 | */ |
||
153 | private function getAllLegacyThemes() { |
||
171 | |||
172 | /** |
||
173 | * @param string $themeName |
||
174 | * @return Theme|false |
||
175 | */ |
||
176 | public function findTheme($themeName) { |
||
183 | } |
||
184 |
This check looks for type mismatches where the missing type is
false
. This is usually indicative of an error condtion.Consider the follow example
This function either returns a new
DateTime
object or false, if there was an error. This is a typical pattern in PHP programming to show that an error has occurred without raising an exception. The calling code should check for this returnedfalse
before passing on the value to another function or method that may not be able to handle afalse
.