@@ -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 | } |
@@ -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')) |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * |
| 55 | - * @param type $type |
|
| 56 | - * @param type $props |
|
| 55 | + * @param string $type |
|
| 56 | + * @param type string |
|
| 57 | 57 | * @throws \RuntimeException |
| 58 | 58 | */ |
| 59 | 59 | private static function create_core_component( $type, $props ) |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * |
| 82 | - * @param type $type |
|
| 83 | - * @param type $props |
|
| 82 | + * @param string $type |
|
| 83 | + * @param type string |
|
| 84 | 84 | * @throws \RuntimeException |
| 85 | 85 | */ |
| 86 | 86 | private static function create_registered_component( $type, $props ) |
@@ -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 | /** |
@@ -67,8 +68,7 @@ discard block |
||
| 67 | 68 | if( file_exists( $file_name ) ) |
| 68 | 69 | { |
| 69 | 70 | require_once $file_name; |
| 70 | - } |
|
| 71 | - else |
|
| 71 | + } else |
|
| 72 | 72 | { |
| 73 | 73 | throw new \RuntimeException("A component of type '$type' does not exist."); |
| 74 | 74 | } |
@@ -182,7 +182,7 @@ |
||
| 182 | 182 | /** |
| 183 | 183 | * Filter the component's value using its filter function (if applicable) |
| 184 | 184 | * |
| 185 | - * @param UI\FilterableComponentInterface $component |
|
| 185 | + * @param FilterableComponentInterface $component |
|
| 186 | 186 | */ |
| 187 | 187 | private function filter( FilterableComponentInterface $component ) |
| 188 | 188 | { |
@@ -124,8 +124,7 @@ |
||
| 124 | 124 | // Unset new instance to force reset |
| 125 | 125 | $this->new_instance = array(); |
| 126 | 126 | return $this->update(); |
| 127 | - } |
|
| 128 | - else |
|
| 127 | + } else |
|
| 129 | 128 | { |
| 130 | 129 | foreach( $this->components as $c ) |
| 131 | 130 | { |