@@ -98,12 +98,10 @@ final public function __construct(Init $init)
9898 {
9999 if ($ init ->config ) {
100100
101- $ caching = isset ($ init ->config ['Caching ' ]['caching ' ]) ?
102- $ init ->config ['Caching ' ]['caching ' ] : 'none ' ;
101+ $ caching = isset ($ init ->config ['Caching ' ]['caching ' ]) ? $ init ->config ['Caching ' ]['caching ' ] : 'none ' ;
103102
104103 $ type = $ init ->config ['General ' ]['filter_type ' ];
105- $ this ->source = $ init ->getBasePath ()
106- . $ init ->config ['General ' ]['filter_path ' ];
104+ $ this ->source = $ init ->getBasePath (). $ init ->config ['General ' ]['filter_path ' ];
107105
108106 if ($ caching && $ caching !== 'none ' ) {
109107 $ this ->cacheSettings = $ init ->config ['Caching ' ];
@@ -186,6 +184,7 @@ private function isCached()
186184 * If caching mode is enabled the result will be cached to increase
187185 * the performance.
188186 *
187+ * @throws \InvalidArgumentException if source file doesn't exist
189188 * @throws \RuntimeException if problems with fetching the XML data occur
190189 * @return object $this
191190 */
@@ -205,14 +204,19 @@ public function getFilterFromXML()
205204 if (file_exists ($ this ->source )) {
206205 if (LIBXML_VERSION >= 20621 ) {
207206 $ filters = simplexml_load_file (
208- $ this ->source ,
209- null ,
210- LIBXML_COMPACT
211- );
207+ $ this ->source ,
208+ null ,
209+ LIBXML_COMPACT
210+ );
212211 } else {
213212 $ filters = simplexml_load_file ($ this ->source );
214213 }
215214 }
215+
216+ throw new \InvalidArgumentException (
217+ sprintf ( 'Invalid config: %s doesn \'t exist. ' ,
218+ $ this ->source )
219+ );
216220 }
217221
218222 /*
@@ -304,12 +308,12 @@ public function getFilterFromJson()
304308 if (!$ filters ) {
305309 if (file_exists ($ this ->source )) {
306310 $ filters = json_decode (file_get_contents ($ this ->source ));
307- } else {
308- throw new \RuntimeException (
309- 'JSON data could not be loaded. ' .
310- ' Make sure you specified the correct path. '
311- );
312311 }
312+
313+ throw new \RuntimeException (
314+ 'JSON data could not be loaded. ' .
315+ ' Make sure you specified the correct path. '
316+ );
313317 }
314318
315319 if (!$ filters ) {
0 commit comments