@@ -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 | /** |
@@ -76,8 +76,7 @@ |
||
| 76 | 76 | ob_start(); |
| 77 | 77 | include( $this->get_script_path() ); |
| 78 | 78 | $rendered_html = ob_get_clean(); |
| 79 | - } |
|
| 80 | - else |
|
| 79 | + } else |
|
| 81 | 80 | { |
| 82 | 81 | throw new \RuntimeException( "Error: cannot render HTML, template file not found at " . $this->get_script_path() ); |
| 83 | 82 | } |
@@ -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 | } |