Skip to content

Commit 8985890

Browse files
committed
Remove is_string checks. No longer required.
1 parent 7f0c1ec commit 8985890

File tree

2 files changed

+0
-30
lines changed

2 files changed

+0
-30
lines changed

src/BCMathService.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ public function __construct(?string $alphabet = null)
3131
$alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
3232
}
3333

34-
// Type validation
35-
if (is_string($alphabet) === false) {
36-
throw new InvalidArgumentException('Argument $alphabet must be a string.');
37-
}
38-
3934
// The alphabet must contain 58 characters
4035
if (strlen($alphabet) !== 58) {
4136
throw new InvalidArgumentException('Argument $alphabet must contain 58 characters.');
@@ -53,11 +48,6 @@ public function __construct(?string $alphabet = null)
5348
*/
5449
public function encode(string $string) : string
5550
{
56-
// Type validation
57-
if (is_string($string) === false) {
58-
throw new InvalidArgumentException('Argument $string must be a string.');
59-
}
60-
6151
// If the string is empty, then the encoded string is obviously empty
6252
if (strlen($string) === 0) {
6353
return '';
@@ -115,11 +105,6 @@ public function encode(string $string) : string
115105
*/
116106
public function decode(string $base58) : string
117107
{
118-
// Type Validation
119-
if (is_string($base58) === false) {
120-
throw new InvalidArgumentException('Argument $base58 must be a string.');
121-
}
122-
123108
// If the string is empty, then the decoded string is obviously empty
124109
if (strlen($base58) === 0) {
125110
return '';

src/GMPService.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ public function __construct(?string $alphabet = null)
3131
$alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
3232
}
3333

34-
// Type validation
35-
if (is_string($alphabet) === false) {
36-
throw new InvalidArgumentException('Argument $alphabet must be a string.');
37-
}
38-
3934
// The alphabet must contain 58 characters
4035
if (strlen($alphabet) !== 58) {
4136
throw new InvalidArgumentException('Argument $alphabet must contain 58 characters.');
@@ -53,11 +48,6 @@ public function __construct(?string $alphabet = null)
5348
*/
5449
public function encode(string $string) : string
5550
{
56-
// Type validation
57-
if (is_string($string) === false) {
58-
throw new InvalidArgumentException('Argument $string must be a string.');
59-
}
60-
6151
// If the string is empty, then the encoded string is obviously empty
6252
if (strlen($string) === 0) {
6353
return '';
@@ -107,11 +97,6 @@ public function encode(string $string) : string
10797
*/
10898
public function decode(string $base58) : string
10999
{
110-
// Type Validation
111-
if (is_string($base58) === false) {
112-
throw new InvalidArgumentException('Argument $base58 must be a string.');
113-
}
114-
115100
// If the string is empty, then the decoded string is obviously empty
116101
if (strlen($base58) === 0) {
117102
return '';

0 commit comments

Comments
 (0)