diff --git a/README.md b/README.md index cc8f940..e276918 100644 --- a/README.md +++ b/README.md @@ -512,8 +512,7 @@ s('دانيال1')->isAlphanumeric(); // true ##### isBase64() -Returns true if the string is base64 encoded, false -otherwise. +Returns true if the string is base64 encoded, false otherwise. ```php s('Zm9vYmFy')->isBase64(); // true diff --git a/src/Stringy.php b/src/Stringy.php index 028caa4..bb39145 100644 --- a/src/Stringy.php +++ b/src/Stringy.php @@ -635,7 +635,7 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess */ public function isBase64() { - return $this->str !== '' && ( base64_encode( base64_decode( $this->str, true ) ) === $this->str ); + return (base64_encode(base64_decode($this->str, true)) === $this->str); } /** diff --git a/tests/StringyTest.php b/tests/StringyTest.php index 0a5206e..3fa1f37 100644 --- a/tests/StringyTest.php +++ b/tests/StringyTest.php @@ -2186,7 +2186,7 @@ class StringyTestCase extends PHPUnit_Framework_TestCase { return array( array(false, ' '), - array(false, ''), + array(true, ''), array(true, base64_encode('FooBar') ), array(true, base64_encode(' ') ), array(true, base64_encode('FÒÔBÀŘ') ),