@@ -17,7 +17,9 @@ |
||
17 | 17 | /** |
18 | 18 | * Prevent loading the library more than once |
19 | 19 | */ |
20 | -if( defined( 'AMARKAL_UI' ) ) return false; |
|
20 | +if( defined( 'AMARKAL_UI' ) ) { |
|
21 | + return false; |
|
22 | +} |
|
21 | 23 | define( 'AMARKAL_UI', true ); |
22 | 24 | |
23 | 25 | if(!function_exists('amarkal_ui_render')) |
@@ -202,7 +202,9 @@ |
||
202 | 202 | */ |
203 | 203 | private function validate( $component ) |
204 | 204 | { |
205 | - if( !($component instanceof ValidatableComponentInterface) ) return; |
|
205 | + if( !($component instanceof ValidatableComponentInterface) ) { |
|
206 | + return; |
|
207 | + } |
|
206 | 208 | |
207 | 209 | $name = $component->name; |
208 | 210 | $validate = $component->validation; |
@@ -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 | } |
@@ -46,8 +46,9 @@ discard block |
||
46 | 46 | if( !in_array($type, self::$registered_components) ) |
47 | 47 | { |
48 | 48 | self::$registered_components[$type] = $class_name; |
49 | + } else { |
|
50 | + throw new \RuntimeException("A component of type '$type' has already been registered."); |
|
49 | 51 | } |
50 | - else throw new \RuntimeException("A component of type '$type' has already been registered."); |
|
51 | 52 | } |
52 | 53 | |
53 | 54 | public static function get_url( $path ) |
@@ -73,8 +74,7 @@ discard block |
||
73 | 74 | if( file_exists( $file_name ) ) |
74 | 75 | { |
75 | 76 | require_once $file_name; |
76 | - } |
|
77 | - else |
|
77 | + } else |
|
78 | 78 | { |
79 | 79 | throw new \RuntimeException("A component of type '$type' does not exist."); |
80 | 80 | } |