diff options
author | Inkeliz <lucasrod2010@aol.com> | 2017-05-04 01:30:03 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-04 01:30:03 -0300 |
commit | bff1419d82fb1030ee2f88eb3a746f9facbe9f50 (patch) | |
tree | 5ebe63575aa431feb527e39bc7136b4a2ed140a7 | |
parent | 34838b89a29c0965d3ef790105f11d151951a87b (diff) | |
download | constant_time_encoding-bff1419d82fb1030ee2f88eb3a746f9facbe9f50.zip constant_time_encoding-bff1419d82fb1030ee2f88eb3a746f9facbe9f50.tar.gz constant_time_encoding-bff1419d82fb1030ee2f88eb3a746f9facbe9f50.tar.bz2 |
Removed duplicated code.
-rw-r--r-- | src/Binary.php | 10 |
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); |