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,8 +572,8 @@ abstract class Engine {
|
||||||
$p_in_min,
|
$p_in_min,
|
||||||
$p_int_max
|
$p_int_max
|
||||||
);
|
);
|
||||||
} else {
|
}
|
||||||
return sprintf(
|
return sprintf(
|
||||||
'<input type="number" name="%s" id="%s" value="%d" min="%d" max="%d"/>',
|
'<input type="number" name="%s" id="%s" value="%d" min="%d" max="%d"/>',
|
||||||
$l_arr_data['name'],
|
$l_arr_data['name'],
|
||||||
$l_arr_data['id'],
|
$l_arr_data['id'],
|
||||||
|
@ -581,7 +581,6 @@ abstract class Engine {
|
||||||
$p_in_min,
|
$p_in_min,
|
||||||
$p_int_max
|
$p_int_max
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,10 @@ class Convert {
|
||||||
$p_int_index = (int) $p_int_index;
|
$p_int_index = (int) $p_int_index;
|
||||||
}
|
}
|
||||||
// Return the whole arrow array.
|
// 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 $l_arr_arrows;
|
||||||
}
|
}
|
||||||
// Return a single arrow.
|
// 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' ) {
|
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.
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->plugin_directory = plugin_dir_path( __DIR__ );
|
$this->plugin_directory = plugin_dir_path( __DIR__ );
|
||||||
|
|
||||||
$template = $this->get_template( $p_str_file_type, $p_str_file_name, $p_str_extension );
|
$template = $this->get_template( $p_str_file_type, $p_str_file_name, $p_str_extension );
|
||||||
|
|
Reference in a new issue