summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorInkeliz <lucasrod2010@aol.com>2017-05-04 01:30:03 -0300
committerGitHub <noreply@github.com>2017-05-04 01:30:03 -0300
commitbff1419d82fb1030ee2f88eb3a746f9facbe9f50 (patch)
tree5ebe63575aa431feb527e39bc7136b4a2ed140a7
parent34838b89a29c0965d3ef790105f11d151951a87b (diff)
downloadconstant_time_encoding-bff1419d82fb1030ee2f88eb3a746f9facbe9f50.zip
constant_time_encoding-bff1419d82fb1030ee2f88eb3a746f9facbe9f50.tar.gz
constant_time_encoding-bff1419d82fb1030ee2f88eb3a746f9facbe9f50.tar.bz2
Removed duplicated code.
-rw-r--r--src/Binary.php10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/Binary.php b/src/Binary.php
index 03476db..92bd9e3 100644
--- a/src/Binary.php
+++ b/src/Binary.php
@@ -69,16 +69,12 @@ abstract class Binary
int $start = 0,
$length = null
): string {
- if (\function_exists('mb_substr')) {
- // $length calculation above might result in a 0-length string
- if ($length === 0) {
- return '';
- }
- return \mb_substr($str, $start, $length, '8bit');
- }
if ($length === 0) {
return '';
}
+ if (\function_exists('mb_substr')) {
+ return \mb_substr($str, $start, $length, '8bit');
+ }
// Unlike mb_substr(), substr() doesn't accept NULL for length
if ($length !== null) {
return \substr($str, $start, $length);