@@ -15,7 +15,9 @@ |
||
15 | 15 | /** |
16 | 16 | * Prevent loading the library more than once |
17 | 17 | */ |
18 | -if( defined( 'AMARKAL_UI' ) ) return; |
|
18 | +if( defined( 'AMARKAL_UI' ) ) { |
|
19 | + return; |
|
20 | +} |
|
19 | 21 | define( 'AMARKAL_UI', true ); |
20 | 22 | |
21 | 23 | /** |
@@ -47,8 +47,9 @@ discard block |
||
47 | 47 | if( !in_array($type, $this->registered_components) ) |
48 | 48 | { |
49 | 49 | $this->registered_components[$type] = $class_name; |
50 | + } else { |
|
51 | + throw new \RuntimeException("A component of type '$type' has already been registered."); |
|
50 | 52 | } |
51 | - else throw new \RuntimeException("A component of type '$type' has already been registered."); |
|
52 | 53 | } |
53 | 54 | |
54 | 55 | /** |
@@ -85,8 +86,7 @@ discard block |
||
85 | 86 | if( file_exists( $file_name ) ) |
86 | 87 | { |
87 | 88 | require_once $file_name; |
88 | - } |
|
89 | - else |
|
89 | + } else |
|
90 | 90 | { |
91 | 91 | throw new \RuntimeException("A component of type '$type' does not exist."); |
92 | 92 | } |
@@ -90,8 +90,7 @@ |
||
90 | 90 | ob_start(); |
91 | 91 | include( $this->get_template_path() ); |
92 | 92 | $rendered_html = ob_get_clean(); |
93 | - } |
|
94 | - else |
|
93 | + } else |
|
95 | 94 | { |
96 | 95 | throw new \RuntimeException( "Error: cannot render HTML, template file not found at " . $this->get_template_path() ); |
97 | 96 | } |