mirror of
https://github.com/danielstjules/Stringy.git
synced 2025-08-09 06:46:40 +02:00
Update isBase64 to return true if an empty string
This commit is contained in:
@@ -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
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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ÀŘ') ),
|
||||
|
Reference in New Issue
Block a user