refactor: change OrIfs to early returns
This commit is contained in:
parent
39871b6cd0
commit
c25bd7d8a2
3 changed files with 10 additions and 6 deletions
|
@ -572,7 +572,7 @@ abstract class Engine {
|
|||
$p_in_min,
|
||||
$p_int_max
|
||||
);
|
||||
} else {
|
||||
}
|
||||
return sprintf(
|
||||
'<input type="number" name="%s" id="%s" value="%d" min="%d" max="%d"/>',
|
||||
$l_arr_data['name'],
|
||||
|
@ -582,6 +582,5 @@ abstract class Engine {
|
|||
$p_int_max
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -185,7 +185,10 @@ class Convert {
|
|||
$p_int_index = (int) $p_int_index;
|
||||
}
|
||||
// Return the whole arrow array.
|
||||
if ( $p_int_index < 0 || $p_int_index > count( $l_arr_arrows ) ) {
|
||||
if ($p_int_index < 0) {
|
||||
return $l_arr_arrows;
|
||||
}
|
||||
if ($p_int_index > count( $l_arr_arrows )) {
|
||||
return $l_arr_arrows;
|
||||
}
|
||||
// Return a single arrow.
|
||||
|
|
|
@ -81,10 +81,12 @@ class Template {
|
|||
*/
|
||||
public function __construct( string $p_str_file_type, string $p_str_file_name, string $p_str_extension = 'html' ) {
|
||||
// No template file type and/or file name set.
|
||||
if ( empty( $p_str_file_type ) || empty( $p_str_file_name ) ) {
|
||||
if (empty( $p_str_file_type )) {
|
||||
return;
|
||||
}
|
||||
if (empty( $p_str_file_name )) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->plugin_directory = plugin_dir_path( __DIR__ );
|
||||
|
||||
$template = $this->get_template( $p_str_file_type, $p_str_file_name, $p_str_extension );
|
||||
|
|
Reference in a new issue