Skip to content

Commit

Permalink
[CODE STYLE] Simple code style improvement
Browse files Browse the repository at this point in the history
Removed redundant nesting by using early return.
  • Loading branch information
Peter van Westen committed Jul 9, 2015
1 parent 307df51 commit b627dff
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions libraries/joomla/language/text.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,24 +298,24 @@ public static function printf($string)
$args = func_get_args();
$count = count($args);

if ($count > 0)
if ($count < 1)
{
if (is_array($args[$count - 1]))
{
$args[0] = $lang->_(
$string, array_key_exists('jsSafe', $args[$count - 1]) ? $args[$count - 1]['jsSafe'] : false,
array_key_exists('interpretBackSlashes', $args[$count - 1]) ? $args[$count - 1]['interpretBackSlashes'] : true
);
}
else
{
$args[0] = $lang->_($string);
}

return call_user_func_array('printf', $args);
return '';
}

if (is_array($args[$count - 1]))
{
$args[0] = $lang->_(
$string, array_key_exists('jsSafe', $args[$count - 1]) ? $args[$count - 1]['jsSafe'] : false,
array_key_exists('interpretBackSlashes', $args[$count - 1]) ? $args[$count - 1]['interpretBackSlashes'] : true
);
}
else
{
$args[0] = $lang->_($string);
}

return '';
return call_user_func_array('printf', $args);
}

/**
Expand Down

0 comments on commit b627dff

Please sign in to comment.