mirror of
https://github.com/danielstjules/Stringy.git
synced 2025-09-01 09:03:03 +02:00
Compare commits
82 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
edbda419cb | ||
|
e8afcffc7c | ||
|
986260239d | ||
|
841600867d | ||
|
845e8d693d | ||
|
b35270671c | ||
|
0aab4361bf | ||
|
df777da6ac | ||
|
ded4d41d44 | ||
|
569736327a | ||
|
6f2e2851ac | ||
|
553bf37acb | ||
|
916f79221e | ||
|
d71d4f0ad6 | ||
|
de93eab01f | ||
|
9b6404d5c3 | ||
|
27a4f11f2e | ||
|
46de78bda9 | ||
|
cb14fc2e6b | ||
|
090a15f2fd | ||
|
d80347e72a | ||
|
0491ed8db8 | ||
|
eb445b55ef | ||
|
91b153d30e | ||
|
9ebdf88b71 | ||
|
0607751e17 | ||
|
6507f0ac44 | ||
|
4e214a5195 | ||
|
fcc2969210 | ||
|
30d1742082 | ||
|
bd90918858 | ||
|
a2d1ec535a | ||
|
b953a85d2c | ||
|
e07a07a076 | ||
|
c4d785d29f | ||
|
5554477962 | ||
|
87c1a47355 | ||
|
6d558974ba | ||
|
5a9b987f9a | ||
|
e3d397fa74 | ||
|
ffc3fa5ff9 | ||
|
c3f25577ed | ||
|
5a4629662c | ||
|
823e50a340 | ||
|
9d77c49fca | ||
|
a074d2a2ac | ||
|
b7cfa84219 | ||
|
e3be6a56ea | ||
|
bdbd4d7541 | ||
|
8419369f3b | ||
|
a3dde38a2f | ||
|
59ce593086 | ||
|
54cf92c89c | ||
|
d320bf8704 | ||
|
2de4c4aee3 | ||
|
fc39b70953 | ||
|
9b61dcc771 | ||
|
b85a84d0b9 | ||
|
e5c3043d75 | ||
|
49a7405a2a | ||
|
63109ce85c | ||
|
b223a2c320 | ||
|
264eed18dd | ||
|
d990a41a1a | ||
|
318db789b1 | ||
|
f086c67ac7 | ||
|
ee59d586f2 | ||
|
3c7bc662a6 | ||
|
2072e667e9 | ||
|
b65da66ae8 | ||
|
604ddc0528 | ||
|
abd5505e98 | ||
|
ee4b89c2f8 | ||
|
ac04be8416 | ||
|
41336996a1 | ||
|
a8793ff711 | ||
|
183e529e15 | ||
|
4673754054 | ||
|
83671e721a | ||
|
c5f370c46d | ||
|
436d269622 | ||
|
c09de057a1 |
16
.editorconfig
Normal file
16
.editorconfig
Normal file
@@ -0,0 +1,16 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.yml]
|
||||
indent_style = space
|
||||
indent_size = 2
|
8
.gitattributes
vendored
Normal file
8
.gitattributes
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
* text=auto
|
||||
|
||||
.editorconfig export-ignore
|
||||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.travis.yml export-ignore
|
||||
phpunit.xml.dist export-ignore
|
||||
tests export-ignore
|
44
.travis.yml
44
.travis.yml
@@ -1,7 +1,43 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.6
|
||||
- 5.5
|
||||
- 5.4
|
||||
- 5.3
|
||||
- hhvm
|
||||
|
||||
# This triggers builds to run on the new TravisCI infrastructure.
|
||||
# See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/
|
||||
sudo: false
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- php: 5.3
|
||||
env: polyfill='true'
|
||||
- php: 5.3
|
||||
env: polyfill='false'
|
||||
- php: 5.4
|
||||
env: polyfill='true'
|
||||
- php: 5.4
|
||||
env: polyfill='false'
|
||||
- php: 5.5
|
||||
env: polyfill='true'
|
||||
- php: 5.5
|
||||
env: polyfill='false'
|
||||
- php: 5.6
|
||||
env: polyfill='true'
|
||||
- php: 5.6
|
||||
env: polyfill='false'
|
||||
- php: 7.0
|
||||
env: polyfill='true'
|
||||
- php: 7.0
|
||||
env: polyfill='false'
|
||||
|
||||
install: travis_retry composer install --no-interaction --prefer-source
|
||||
|
||||
before_script:
|
||||
- travis_retry composer self-update
|
||||
- travis_retry composer install --no-interaction --prefer-source
|
||||
- if [[ $polyfill = 'false' ]]; then travis_retry composer remove symfony/polyfill-mbstring; fi
|
||||
|
||||
script:
|
||||
- vendor/bin/phpunit
|
||||
|
||||
|
32
CHANGELOG.md
32
CHANGELOG.md
@@ -1,3 +1,35 @@
|
||||
### 2.4.0 (2017-03-02)
|
||||
|
||||
* Add startsWithAny
|
||||
* Add endsWithAny
|
||||
* Add stripWhitespace
|
||||
* Fix error handling for unsupported encodings
|
||||
* Change private methods to protected for extending class
|
||||
* Fix safeTruncate for strings without spaces
|
||||
* Additional char support in toAscii, e.g. full width chars and wide
|
||||
non-breaking space
|
||||
|
||||
### 2.3.2 (2016-05-02)
|
||||
|
||||
* Improve support without mbstring
|
||||
|
||||
### 2.3.1 (2016-03-21)
|
||||
|
||||
* Always use root namespace for mbstring functions
|
||||
|
||||
### 2.3.0 (2016-03-19)
|
||||
|
||||
* Add Persian characters in Stringy::charsArray()
|
||||
* Use symfony/polyfill-mbstring to avoid dependency on ext-mbstring
|
||||
|
||||
### 2.2.0 (2015-12-20)
|
||||
|
||||
* isJSON now returns false for empty strings
|
||||
* Update for German umlaut transformation
|
||||
* Use reflection to generate method list for StaticStringy
|
||||
* Added isBase64 method
|
||||
* Improved toAscii char coverage
|
||||
|
||||
### 2.1.0 (2015-09-02)
|
||||
|
||||
* Added simplified StaticStringy class
|
||||
|
271
README.md
271
README.md
@@ -1,7 +1,7 @@
|
||||

|
||||
|
||||
A PHP string manipulation library with multibyte support. Compatible with PHP
|
||||
5.3+ and HHVM. Refer to the [1.x branch](https://github.com/danielstjules/Stringy/tree/1.x)
|
||||
5.3+, PHP 7, and HHVM. Refer to the [1.x branch](https://github.com/danielstjules/Stringy/tree/1.x)
|
||||
for older documentation.
|
||||
|
||||
``` php
|
||||
@@ -9,6 +9,8 @@ s('string')->toTitleCase()->ensureRight('y') == 'Stringy'
|
||||
```
|
||||
|
||||
[](https://travis-ci.org/danielstjules/Stringy)
|
||||
[](https://packagist.org/packages/danielstjules/stringy)
|
||||
[](https://packagist.org/packages/danielstjules/stringy)
|
||||
|
||||
* [Why?](#why)
|
||||
* [Installation](#installation)
|
||||
@@ -19,82 +21,128 @@ s('string')->toTitleCase()->ensureRight('y') == 'Stringy'
|
||||
* [Class methods](#class-methods)
|
||||
* [create](#createmixed-str--encoding-)
|
||||
* [Instance methods](#instance-methods)
|
||||
* [append](#appendstring-string)
|
||||
* [at](#atint-index)
|
||||
* [between](#betweenstring-start-string-end--int-offset)
|
||||
* [camelize](#camelize)
|
||||
* [chars](#chars)
|
||||
* [collapseWhitespace](#collapsewhitespace)
|
||||
* [contains](#containsstring-needle--boolean-casesensitive--true-)
|
||||
* [containsAll](#containsallarray-needles--boolean-casesensitive--true-)
|
||||
* [containsAny](#containsanyarray-needles--boolean-casesensitive--true-)
|
||||
* [countSubstr](#countsubstrstring-substring--boolean-casesensitive--true-)
|
||||
* [dasherize](#dasherize)
|
||||
* [delimit](#delimitint-delimiter)
|
||||
* [endsWith](#endswithstring-substring--boolean-casesensitive--true-)
|
||||
* [ensureLeft](#ensureleftstring-substring)
|
||||
* [ensureRight](#ensurerightstring-substring)
|
||||
* [first](#firstint-n)
|
||||
* [getEncoding](#getencoding)
|
||||
* [hasLowerCase](#haslowercase)
|
||||
* [hasUpperCase](#hasuppercase)
|
||||
* [htmlDecode](#htmldecode)
|
||||
* [htmlEncode](#htmlencode)
|
||||
* [humanize](#humanize)
|
||||
* [indexOf](#indexofstring-needle--offset--0-)
|
||||
* [indexOfLast](#indexoflaststring-needle--offset--0-)
|
||||
* [insert](#insertint-index-string-substring)
|
||||
* [isAlpha](#isalpha)
|
||||
* [isAlphanumeric](#isalphanumeric)
|
||||
* [isBlank](#isblank)
|
||||
* [isHexadecimal](#ishexadecimal)
|
||||
* [isJson](#isjson)
|
||||
* [isLowerCase](#islowercase)
|
||||
* [isSerialized](#isserialized)
|
||||
* [isUpperCase](#isuppercase)
|
||||
* [last](#last)
|
||||
* [length](#length)
|
||||
* [lines](#lines)
|
||||
* [longestCommonPrefix](#longestcommonprefixstring-otherstr)
|
||||
* [longestCommonSuffix](#longestcommonsuffixstring-otherstr)
|
||||
* [longestCommonSubstring](#longestcommonsubstringstring-otherstr)
|
||||
* [lowerCaseFirst](#lowercasefirst)
|
||||
* [pad](#padint-length--string-padstr-----string-padtype--right-)
|
||||
* [padBoth](#padbothint-length--string-padstr----)
|
||||
* [padLeft](#padleftint-length--string-padstr----)
|
||||
* [padRight](#padrightint-length--string-padstr----)
|
||||
* [prepend](#prependstring-string)
|
||||
* [regexReplace](#regexreplacestring-pattern-string-replacement--string-options--msr)
|
||||
* [removeLeft](#removeleftstring-substring)
|
||||
* [removeRight](#removerightstring-substring)
|
||||
* [repeat](#repeatmultiplier)
|
||||
* [replace](#replacestring-search-string-replacement)
|
||||
* [reverse](#reverse)
|
||||
* [safeTruncate](#safetruncateint-length--string-substring---)
|
||||
* [shuffle](#shuffle)
|
||||
* [slugify](#slugify-string-replacement----)
|
||||
* [startsWith](#startswithstring-substring--boolean-casesensitive--true-)
|
||||
* [slice](#sliceint-start--int-end-)
|
||||
* [split](#splitstring-pattern--int-limit-)
|
||||
* [substr](#substrint-start--int-length-)
|
||||
* [surround](#surroundstring-substring)
|
||||
* [swapCase](#swapcase)
|
||||
* [tidy](#tidy)
|
||||
* [titleize](#titleize-array-ignore)
|
||||
* [toAscii](#toascii)
|
||||
* [toBoolean](#toboolean)
|
||||
* [toLowerCase](#tolowercase)
|
||||
* [toSpaces](#tospaces-tablength--4-)
|
||||
* [toTabs](#totabs-tablength--4-)
|
||||
* [toTitleCase](#totitlecase)
|
||||
* [toUpperCase](#touppercase)
|
||||
* [trim](#trim-string-chars)
|
||||
* [trimLeft](#trimleft-string-chars)
|
||||
* [trimRight](#trimright-string-chars)
|
||||
* [truncate](#truncateint-length--string-substring---)
|
||||
* [underscored](#underscored)
|
||||
* [upperCamelize](#uppercamelize)
|
||||
* [upperCaseFirst](#uppercasefirst)
|
||||
<table>
|
||||
<tr>
|
||||
<td>[append](#appendstring-string)</td>
|
||||
<td>[at](#atint-index)</td>
|
||||
<td>[between](#betweenstring-start-string-end--int-offset)</td>
|
||||
<td>[camelize](#camelize)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[chars](#chars)</td>
|
||||
<td>[collapseWhitespace](#collapsewhitespace)</td>
|
||||
<td>[contains](#containsstring-needle--boolean-casesensitive--true-)</td>
|
||||
<td>[containsAll](#containsallarray-needles--boolean-casesensitive--true-)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[containsAny](#containsanyarray-needles--boolean-casesensitive--true-)</td>
|
||||
<td>[countSubstr](#countsubstrstring-substring--boolean-casesensitive--true-)</td>
|
||||
<td>[dasherize](#dasherize)</td>
|
||||
<td>[delimit](#delimitint-delimiter)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[endsWith](#endswithstring-substring--boolean-casesensitive--true-)</td>
|
||||
<td>[endsWithAny](#endsWithAnystring-substrings--boolean-casesensitive--true-)</td>
|
||||
<td>[ensureLeft](#ensureleftstring-substring)</td>
|
||||
<td>[ensureRight](#ensurerightstring-substring)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[first](#firstint-n)</td>
|
||||
<td>[getEncoding](#getencoding)</td>
|
||||
<td>[hasLowerCase](#haslowercase)</td>
|
||||
<td>[hasUpperCase](#hasuppercase)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[htmlDecode](#htmldecode)</td>
|
||||
<td>[htmlEncode](#htmlencode)</td>
|
||||
<td>[humanize](#humanize)</td>
|
||||
<td>[indexOf](#indexofstring-needle--offset--0-)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[indexOfLast](#indexoflaststring-needle--offset--0-)</td>
|
||||
<td>[insert](#insertint-index-string-substring)</td>
|
||||
<td>[isAlpha](#isalpha)</td>
|
||||
<td>[isAlphanumeric](#isalphanumeric)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[isBase64](#isbase64)</td>
|
||||
<td>[isBlank](#isblank)</td>
|
||||
<td>[isHexadecimal](#ishexadecimal)</td>
|
||||
<td>[isJson](#isjson)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[isLowerCase](#islowercase)</td>
|
||||
<td>[isSerialized](#isserialized)</td>
|
||||
<td>[isUpperCase](#isuppercase)</td>
|
||||
<td>[last](#last)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[length](#length)</td>
|
||||
<td>[lines](#lines)</td>
|
||||
<td>[longestCommonPrefix](#longestcommonprefixstring-otherstr)</td>
|
||||
<td>[longestCommonSuffix](#longestcommonsuffixstring-otherstr)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[longestCommonSubstring](#longestcommonsubstringstring-otherstr)</td>
|
||||
<td>[lowerCaseFirst](#lowercasefirst)</td>
|
||||
<td>[pad](#padint-length--string-padstr-----string-padtype--right-)</td>
|
||||
<td>[padBoth](#padbothint-length--string-padstr----)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[padLeft](#padleftint-length--string-padstr----)</td>
|
||||
<td>[padRight](#padrightint-length--string-padstr----)</td>
|
||||
<td>[prepend](#prependstring-string)</td>
|
||||
<td>[regexReplace](#regexreplacestring-pattern-string-replacement--string-options--msr)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[removeLeft](#removeleftstring-substring)</td>
|
||||
<td>[removeRight](#removerightstring-substring)</td>
|
||||
<td>[repeat](#repeatmultiplier)</td>
|
||||
<td>[replace](#replacestring-search-string-replacement)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[reverse](#reverse)</td>
|
||||
<td>[safeTruncate](#safetruncateint-length--string-substring---)</td>
|
||||
<td>[shuffle](#shuffle)</td>
|
||||
<td>[slugify](#slugify-string-replacement----)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[startsWith](#startswithstring-substring--boolean-casesensitive--true-)</td>
|
||||
<td>[startsWithAny](#startswithanystring-substrings--boolean-casesensitive--true-)</td>
|
||||
<td>[slice](#sliceint-start--int-end-)</td>
|
||||
<td>[split](#splitstring-pattern--int-limit-)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[stripWhitespace](#stripwhitespace)</td>
|
||||
<td>[substr](#substrint-start--int-length-)</td>
|
||||
<td>[surround](#surroundstring-substring)</td>
|
||||
<td>[swapCase](#swapcase)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[tidy](#tidy)</td>
|
||||
<td>[titleize](#titleize-array-ignore)</td>
|
||||
<td>[toAscii](#toascii)</td>
|
||||
<td>[toBoolean](#toboolean)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[toLowerCase](#tolowercase)</td>
|
||||
<td>[toSpaces](#tospaces-tablength--4-)</td>
|
||||
<td>[toTabs](#totabs-tablength--4-)</td>
|
||||
<td>[toTitleCase](#totitlecase)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[toUpperCase](#touppercase)</td>
|
||||
<td>[trim](#trim-string-chars)</td>
|
||||
<td>[trimLeft](#trimleft-string-chars)</td>
|
||||
<td>[trimRight](#trimright-string-chars)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[truncate](#truncateint-length--string-substring---)</td>
|
||||
<td>[underscored](#underscored)</td>
|
||||
<td>[upperCamelize](#uppercamelize)</td>
|
||||
<td>[upperCaseFirst](#uppercasefirst)</td>
|
||||
</tr>
|
||||
</table>
|
||||
* [Extensions](#extensions)
|
||||
* [Tests](#tests)
|
||||
* [License](#license)
|
||||
@@ -128,7 +176,7 @@ in your composer.json file:
|
||||
|
||||
```json
|
||||
"require": {
|
||||
"danielstjules/stringy": "~2.1"
|
||||
"danielstjules/stringy": "~2.4"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -151,11 +199,13 @@ And in either case, I'd suggest using an alias.
|
||||
use Stringy\Stringy as S;
|
||||
```
|
||||
|
||||
Please note that Stringy relies on the `mbstring` PHP module for its underlying
|
||||
multibyte support. This is a non-default, but very common module. For example,
|
||||
with debian and ubuntu, it's included in libapache2-mod-php5, php5-cli, and
|
||||
php5-fpm. For OSX users, it's a default for any version of PHP installed with
|
||||
homebrew. If compiling PHP from scratch, it can be included with the
|
||||
Please note that Stringy relies on the `mbstring` module for its underlying
|
||||
multibyte support. If the module is not found, Stringy will use
|
||||
[symfony/polyfill-mbstring](https://github.com/symfony/polyfill-mbstring).
|
||||
ex-mbstring is a non-default, but very common module. For example, with debian
|
||||
and ubuntu, it's included in libapache2-mod-php5, php5-cli, and php5-fpm. For
|
||||
OSX users, it's a default for any version of PHP installed with homebrew.
|
||||
If compiling PHP from scratch, it can be included with the
|
||||
`--enable-mbstring` flag.
|
||||
|
||||
## OO and Chaining
|
||||
@@ -234,9 +284,9 @@ integer, boolean, etc.
|
||||
```php
|
||||
use Stringy\StaticStringy as S;
|
||||
|
||||
// Translates to Stringy::create('fòôbàř', 'UTF-8')->slice(0, 3);
|
||||
// Translates to Stringy::create('fòôbàř')->slice(0, 3);
|
||||
// Returns a Stringy object with the string "fòô"
|
||||
S::slice('fòôbàř', 0, 3, 'UTF-8');
|
||||
S::slice('fòôbàř', 0, 3);
|
||||
```
|
||||
|
||||
## Class methods
|
||||
@@ -250,7 +300,7 @@ then returns the initialized object. Throws an InvalidArgumentException
|
||||
if the first argument is an array or object without a __toString method.
|
||||
|
||||
```php
|
||||
$stringy = S::create('fòôbàř', 'UTF-8'); // 'fòôbàř'
|
||||
$stringy = S::create('fòôbàř'); // 'fòôbàř'
|
||||
```
|
||||
|
||||
## Instance Methods
|
||||
@@ -386,6 +436,16 @@ setting $caseSensitive to false.
|
||||
s('fòôbàř')->endsWith('bàř', true); // true
|
||||
```
|
||||
|
||||
##### endsWithAny(string[] $substrings [, boolean $caseSensitive = true ])
|
||||
|
||||
Returns true if the string ends with any of $substrings, false otherwise.
|
||||
By default, the comparison is case-sensitive, but can be made insensitive
|
||||
by setting $caseSensitive to false.
|
||||
|
||||
```php
|
||||
s('fòôbàř')->endsWith(['bàř', 'baz'], true); // true
|
||||
```
|
||||
|
||||
##### ensureLeft(string $substring)
|
||||
|
||||
Ensures that the string begins with $substring. If it doesn't, it's prepended.
|
||||
@@ -396,7 +456,7 @@ s('foobar')->ensureLeft('http://'); // 'http://foobar'
|
||||
|
||||
##### ensureRight(string $substring)
|
||||
|
||||
Ensures that the string begins with $substring. If it doesn't, it's appended.
|
||||
Ensures that the string ends with $substring. If it doesn't, it's appended.
|
||||
|
||||
```php
|
||||
s('foobar')->ensureRight('.com'); // 'foobar.com'
|
||||
@@ -415,7 +475,7 @@ s('fòôbàř')->first(3); // 'fòô'
|
||||
Returns the encoding used by the Stringy object.
|
||||
|
||||
```php
|
||||
s('fòôbàř', 'UTF-8')->getEncoding(); // 'UTF-8'
|
||||
s('fòôbàř')->getEncoding(); // 'UTF-8'
|
||||
```
|
||||
|
||||
##### hasLowerCase()
|
||||
@@ -509,6 +569,14 @@ otherwise.
|
||||
s('دانيال1')->isAlphanumeric(); // true
|
||||
```
|
||||
|
||||
##### isBase64()
|
||||
|
||||
Returns true if the string is base64 encoded, false otherwise.
|
||||
|
||||
```php
|
||||
s('Zm9vYmFy')->isBase64(); // true
|
||||
```
|
||||
|
||||
##### isBlank()
|
||||
|
||||
Returns true if the string contains only whitespace chars, false otherwise.
|
||||
@@ -527,7 +595,9 @@ s('A102F')->isHexadecimal(); // true
|
||||
|
||||
##### isJson()
|
||||
|
||||
Returns true if the string is JSON, false otherwise.
|
||||
Returns true if the string is JSON, false otherwise. Unlike json_decode
|
||||
in PHP 5.x, this method is consistent with PHP 7 and other JSON parsers,
|
||||
in that an empty string is not considered valid JSON.
|
||||
|
||||
```php
|
||||
s('{"foo":"bar"}')->isJson(); // true
|
||||
@@ -671,7 +741,8 @@ to a lack of support in the bundled version of Oniguruma in PHP < 5.6,
|
||||
and current versions of HHVM (3.8 and below).
|
||||
|
||||
```php
|
||||
s('fòô ')->regexReplace('f[òô]+\s', 'bàř', 'msr'); // 'bàř'
|
||||
s('fòô ')->regexReplace('f[òô]+\s', 'bàř'); // 'bàř'
|
||||
s('fò')->regexReplace('(ò)', '\\1ô'); // 'fòô'
|
||||
```
|
||||
|
||||
##### removeLeft(string $substring)
|
||||
@@ -757,6 +828,16 @@ by setting $caseSensitive to false.
|
||||
s('FÒÔbàřbaz')->startsWith('fòôbàř', false); // true
|
||||
```
|
||||
|
||||
##### startsWithAny(string[] $substrings [, boolean $caseSensitive = true ])
|
||||
|
||||
Returns true if the string begins with any of $substrings, false
|
||||
otherwise. By default the comparison is case-sensitive, but can be made
|
||||
insensitive by setting $caseSensitive to false.
|
||||
|
||||
```php
|
||||
s('FÒÔbàřbaz')->startsWith(['fòô', 'bàř'], false); // true
|
||||
```
|
||||
|
||||
##### slice(int $start [, int $end ])
|
||||
|
||||
Returns the substring beginning at $start, and up to, but not including
|
||||
@@ -778,6 +859,16 @@ results.
|
||||
s('foo,bar,baz')->split(',', 2); // ['foo', 'bar']
|
||||
```
|
||||
|
||||
##### stripWhitespace()
|
||||
|
||||
Strip all whitespace characters. This includes tabs and newline
|
||||
characters, as well as multibyte whitespace such as the thin space
|
||||
and ideographic space.
|
||||
|
||||
```php
|
||||
s(' Ο συγγραφέας ')->stripWhitespace(); // 'Οσυγγραφέας'
|
||||
```
|
||||
|
||||
##### substr(int $start [, int $length ])
|
||||
|
||||
Returns the substring beginning at $start with the specified $length.
|
||||
|
@@ -16,7 +16,7 @@
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"ext-mbstring": "*"
|
||||
"symfony/polyfill-mbstring": "~1.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.0"
|
||||
|
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit processIsolation="false"
|
||||
<phpunit bootstrap="vendor/autoload.php"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false">
|
||||
<testsuites>
|
||||
|
@@ -2,6 +2,91 @@
|
||||
|
||||
namespace Stringy;
|
||||
|
||||
use BadMethodCallException;
|
||||
use ReflectionClass;
|
||||
use ReflectionMethod;
|
||||
|
||||
/**
|
||||
* Class StaticStringy
|
||||
*
|
||||
* @method static string append(string $str, string $stringAppend, string $encoding = null)
|
||||
* @method static string at(string $str, int $index, string $encoding = null)
|
||||
* @method static string between(string $str, string $start, string $end, int $offset = 0, string $encoding = null)
|
||||
* @method static string camelize(string $str, string $encoding = null)
|
||||
* @method static string chars(string $str, string $encoding = null)
|
||||
* @method static string collapseWhitespace(string $str, string $encoding = null)
|
||||
* @method static bool contains(string $str, string $needle, bool $caseSensitive = true, string $encoding = null)
|
||||
* @method static bool containsAll(string $str, string $needle, bool $caseSensitive = true, string $encoding = null)
|
||||
* @method static bool containsAny(string $str, string $needle, bool $caseSensitive = true, string $encoding = null)
|
||||
* @method static int count(string $str, string $encoding = null)
|
||||
* @method static int countSubstr(string $str, string $substring, bool $caseSensitive = true, string $encoding = null)
|
||||
* @method static string dasherize(string $str, string $encoding = null)
|
||||
* @method static string delimit(string $str, string $delimiter, string $encoding = null)
|
||||
* @method static bool endsWith(string $str, string $substring, bool $caseSensitive = true, string $encoding = null)
|
||||
* @method static string ensureLeft(string $str, string $substring, string $encoding = null)
|
||||
* @method static string ensureRight(string $str, string $substring, string $encoding = null)
|
||||
* @method static string first(string $str, int $n, string $encoding = null)
|
||||
* @method static bool hasLowerCase(string $str, string $encoding = null)
|
||||
* @method static bool hasUpperCase(string $str, string $encoding = null)
|
||||
* @method static string htmlDecode(string $str, int $flags = ENT_COMPAT, string $encoding = null)
|
||||
* @method static string htmlEncode(string $str, int $flags = ENT_COMPAT, string $encoding = null)
|
||||
* @method static string humanize(string $str, string $encoding = null)
|
||||
* @method static int indexOf(string $str, string $needle, int $offset = 0, string $encoding = null)
|
||||
* @method static int indexOfLast(string $str, string $needle, int $offset = 0, string $encoding = null)
|
||||
* @method static string insert(string $str, string $substring, int $index = 0, string $encoding = null)
|
||||
* @method static bool isAlpha(string $str, string $encoding = null)
|
||||
* @method static bool isAlphanumeric(string $str, string $encoding = null)
|
||||
* @method static bool isBase64(string $str, string $encoding = null)
|
||||
* @method static bool isBlank(string $str, string $encoding = null)
|
||||
* @method static bool isHexadecimal(string $str, string $encoding = null)
|
||||
* @method static bool isJson(string $str, string $encoding = null)
|
||||
* @method static bool isLowerCase(string $str, string $encoding = null)
|
||||
* @method static bool isSerialized(string $str, string $encoding = null)
|
||||
* @method static bool isUpperCase(string $str, string $encoding = null)
|
||||
* @method static string last(string $str, string $encoding = null)
|
||||
* @method static int length(string $str, string $encoding = null)
|
||||
* @method static Stringy[] lines(string $str, string $encoding = null)
|
||||
* @method static string longestCommonPrefix(string $str, string $otherStr, string $encoding = null)
|
||||
* @method static string longestCommonSuffix(string $str, string $otherStr, string $encoding = null)
|
||||
* @method static string longestCommonSubstring(string $str, string $otherStr, string $encoding = null)
|
||||
* @method static string lowerCaseFirst(string $str, string $encoding = null)
|
||||
* @method static string pad(string $str, int $length, string $padStr = ' ', string $padType = 'right', string $encoding = null)
|
||||
* @method static string padBoth(string $str, int $length, string $padStr = ' ', string $encoding = null)
|
||||
* @method static string padLeft(string $str, int $length, string $padStr = ' ', string $encoding = null)
|
||||
* @method static string padRight(string $str, int $length, string $padStr = ' ', string $encoding = null)
|
||||
* @method static string prepend(string $str, string $string, string $encoding = null)
|
||||
* @method static string regexReplace(string $str, string $pattern, string $replacement, string $options = 'msr', string $encoding = null)
|
||||
* @method static string removeLeft(string $str, string $substring, string $encoding = null)
|
||||
* @method static string removeRight(string $str, string $substring, string $encoding = null)
|
||||
* @method static string repeat(string $str, int $multiplier, string $encoding = null)
|
||||
* @method static string replace(string $str, string $search, string $replacement, string $encoding = null)
|
||||
* @method static string reverse(string $str, string $encoding = null)
|
||||
* @method static string safeTruncate(string $str, int $length, string $substring = '', string $encoding = null)
|
||||
* @method static string shuffle(string $str, string $encoding = null)
|
||||
* @method static string slugify(string $str, string $replacement = '-', string $encoding = null)
|
||||
* @method static bool startsWith(string $str, string $substring, bool $caseSensitive = true, string $encoding = null)
|
||||
* @method static string slice(string $str, int $start, int $end = null, string $encoding = null)
|
||||
* @method static string split(string $str, string $pattern, int $limit = null, string $encoding = null)
|
||||
* @method static string substr(string $str, int $start, int $length = null, string $encoding = null)
|
||||
* @method static string surround(string $str, string $substring, string $encoding = null)
|
||||
* @method static string swapCase(string $str, string $encoding = null)
|
||||
* @method static string tidy(string $str, string $encoding = null)
|
||||
* @method static string titleize(string $str, string $encoding = null)
|
||||
* @method static string toAscii(string $str, bool $removeUnsupported = true, string $encoding = null)
|
||||
* @method static bool toBoolean(string $str, string $encoding = null)
|
||||
* @method static string toLowerCase(string $str, string $encoding = null)
|
||||
* @method static string toSpaces(string $str, int $tabLength = 4, string $encoding = null)
|
||||
* @method static string toTabs(string $str, int $tabLength = 4, string $encoding = null)
|
||||
* @method static string toTitleCase(string $str, string $encoding = null)
|
||||
* @method static string toUpperCase(string $str, string $encoding = null)
|
||||
* @method static string trim(string $str, string $chars = null, string $encoding = null)
|
||||
* @method static string trimLeft(string $str, string $chars = null, string $encoding = null)
|
||||
* @method static string trimRight(string $str, string $chars = null, string $encoding = null)
|
||||
* @method static string truncate(string $str, int $length, string $substring = '', string $encoding = null)
|
||||
* @method static string underscored(string $str, string $encoding = null)
|
||||
* @method static string upperCamelize(string $str, string $encoding = null)
|
||||
* @method static string upperCaseFirst(string $str, string $encoding = null)
|
||||
*/
|
||||
class StaticStringy
|
||||
{
|
||||
/**
|
||||
@@ -11,85 +96,7 @@ class StaticStringy
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $methodArgs = array(
|
||||
'append' => 3,
|
||||
'at' => 3,
|
||||
'between' => 5,
|
||||
'camelize' => 2,
|
||||
'chars' => 2,
|
||||
'collapseWhitespace' => 2,
|
||||
'contains' => 4,
|
||||
'containsAll' => 4,
|
||||
'containsAny' => 4,
|
||||
'count' => 2,
|
||||
'countSubstr' => 4,
|
||||
'dasherize' => 2,
|
||||
'delimit' => 3,
|
||||
'endsWith' => 4,
|
||||
'ensureLeft' => 3,
|
||||
'ensureRight' => 3,
|
||||
'first' => 3,
|
||||
'getEncoding' => 2,
|
||||
'hasLowerCase' => 2,
|
||||
'hasUpperCase' => 2,
|
||||
'htmlDecode' => 3,
|
||||
'htmlEncode' => 3,
|
||||
'humanize' => 2,
|
||||
'indexOf' => 4,
|
||||
'indexOfLast' => 4,
|
||||
'insert' => 4,
|
||||
'isAlpha' => 2,
|
||||
'isAlphanumeric' => 2,
|
||||
'isBlank' => 2,
|
||||
'isHexadecimal' => 2,
|
||||
'isJson' => 2,
|
||||
'isLowerCase' => 2,
|
||||
'isSerialized' => 2,
|
||||
'isUpperCase' => 2,
|
||||
'last' => 3,
|
||||
'length' => 2,
|
||||
'lines' => 2,
|
||||
'longestCommonPrefix' => 3,
|
||||
'longestCommonSuffix' => 3,
|
||||
'longestCommonSubstring' => 3,
|
||||
'lowerCaseFirst' => 2,
|
||||
'pad' => 5,
|
||||
'padBoth' => 4,
|
||||
'padLeft' => 4,
|
||||
'padRight' => 4,
|
||||
'prepend' => 3,
|
||||
'regexReplace' => 5,
|
||||
'removeLeft' => 3,
|
||||
'removeRight' => 3,
|
||||
'repeat' => 3,
|
||||
'replace' => 4,
|
||||
'reverse' => 2,
|
||||
'safeTruncate' => 4,
|
||||
'shuffle' => 2,
|
||||
'slugify' => 3,
|
||||
'startsWith' => 4,
|
||||
'slice' => 4,
|
||||
'split' => 4,
|
||||
'substr' => 4,
|
||||
'surround' => 3,
|
||||
'swapCase' => 2,
|
||||
'tidy' => 2,
|
||||
'titleize' => 3,
|
||||
'toAscii' => 3,
|
||||
'toBoolean' => 2,
|
||||
'toLowerCase' => 2,
|
||||
'toSpaces' => 3,
|
||||
'toTabs' => 3,
|
||||
'toTitleCase' => 2,
|
||||
'toUpperCase' => 2,
|
||||
'trim' => 3,
|
||||
'trimLeft' => 3,
|
||||
'trimRight' => 3,
|
||||
'truncate' => 4,
|
||||
'underscored' => 2,
|
||||
'upperCamelize' => 2,
|
||||
'upperCaseFirst' => 2
|
||||
);
|
||||
protected static $methodArgs = null;
|
||||
|
||||
/**
|
||||
* Creates an instance of Stringy and invokes the given method with the
|
||||
@@ -102,11 +109,25 @@ class StaticStringy
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed[] $arguments
|
||||
*
|
||||
* @return Stringy
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public static function __callStatic($name, $arguments)
|
||||
{
|
||||
if (!static::$methodArgs) {
|
||||
$stringyClass = new ReflectionClass('Stringy\Stringy');
|
||||
$methods = $stringyClass->getMethods(ReflectionMethod::IS_PUBLIC);
|
||||
|
||||
foreach ($methods as $method) {
|
||||
$params = $method->getNumberOfParameters() + 2;
|
||||
static::$methodArgs[$method->name] = $params;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset(static::$methodArgs[$name])) {
|
||||
throw new \BadMethodCallException($name . ' is not a valid method');
|
||||
throw new BadMethodCallException($name . ' is not a valid method');
|
||||
}
|
||||
|
||||
$numArgs = count($arguments);
|
||||
|
674
src/Stringy.php
674
src/Stringy.php
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
require __DIR__ . '/../src/Create.php';
|
||||
|
||||
use function Stringy\create as s;
|
||||
|
||||
class CreateTestCase extends PHPUnit_Framework_TestCase
|
||||
|
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
require __DIR__ . '/../src/StaticStringy.php';
|
||||
|
||||
use Stringy\StaticStringy as S;
|
||||
|
||||
class StaticStringyTestCase extends PHPUnit_Framework_TestCase
|
||||
|
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
require __DIR__ . '/../src/Stringy.php';
|
||||
|
||||
use Stringy\Stringy as S;
|
||||
|
||||
class StringyTestCase extends PHPUnit_Framework_TestCase
|
||||
@@ -846,6 +844,36 @@ class StringyTestCase extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider startsWithProviderAny()
|
||||
*/
|
||||
public function testStartsWithAny($expected, $str, $substrings,
|
||||
$caseSensitive = true, $encoding = null)
|
||||
{
|
||||
$stringy = S::create($str, $encoding);
|
||||
$result = $stringy->startsWithAny($substrings, $caseSensitive);
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertEquals($expected, $result);
|
||||
$this->assertEquals($str, $stringy);
|
||||
}
|
||||
|
||||
public function startsWithProviderAny()
|
||||
{
|
||||
return array(
|
||||
array(true, 'foo bars', array('foo bar')),
|
||||
array(true, 'FOO bars', array('foo bar'), false),
|
||||
array(true, 'FOO bars', array('foo bar', 'foo BAR'), false),
|
||||
array(true, 'FÒÔ bàřs', array('foo bar', 'fòô bàř'), false, 'UTF-8'),
|
||||
array(true, 'fòô bàřs', array('foo bar', 'fòô BÀŘ'), false, 'UTF-8'),
|
||||
array(false, 'foo bar', array('bar')),
|
||||
array(false, 'foo bar', array('foo bars')),
|
||||
array(false, 'FOO bar', array('foo bars')),
|
||||
array(false, 'FOO bars', array('foo BAR')),
|
||||
array(false, 'FÒÔ bàřs', array('fòô bàř'), true, 'UTF-8'),
|
||||
array(false, 'fòô bàřs', array('fòô BÀŘ'), true, 'UTF-8'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider endsWithProvider()
|
||||
*/
|
||||
@@ -876,6 +904,36 @@ class StringyTestCase extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider endsWithAnyProvider()
|
||||
*/
|
||||
public function testEndsWithAny($expected, $str, $substrings,
|
||||
$caseSensitive = true, $encoding = null)
|
||||
{
|
||||
$stringy = S::create($str, $encoding);
|
||||
$result = $stringy->endsWithAny($substrings, $caseSensitive);
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertEquals($expected, $result);
|
||||
$this->assertEquals($str, $stringy);
|
||||
}
|
||||
|
||||
public function endsWithAnyProvider()
|
||||
{
|
||||
return array(
|
||||
array(true, 'foo bars', array('foo', 'o bars')),
|
||||
array(true, 'FOO bars', array('foo', 'o bars'), false),
|
||||
array(true, 'FOO bars', array('foo', 'o BARs'), false),
|
||||
array(true, 'FÒÔ bàřs', array('foo', 'ô bàřs'), false, 'UTF-8'),
|
||||
array(true, 'fòô bàřs', array('foo', 'ô BÀŘs'), false, 'UTF-8'),
|
||||
array(false, 'foo bar', array('foo')),
|
||||
array(false, 'foo bar', array('foo', 'foo bars')),
|
||||
array(false, 'FOO bar', array('foo', 'foo bars')),
|
||||
array(false, 'FOO bars', array('foo', 'foo BARS')),
|
||||
array(false, 'FÒÔ bàřs', array('fòô', 'fòô bàřs'), true, 'UTF-8'),
|
||||
array(false, 'fòô bàřs', array('fòô', 'fòô BÀŘS'), true, 'UTF-8'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider toBooleanProvider()
|
||||
*/
|
||||
@@ -1351,18 +1409,18 @@ class StringyTestCase extends PHPUnit_Framework_TestCase
|
||||
array('Test foo...', 'Test foo bar', 11, '...'),
|
||||
array('Test...', 'Test foo bar', 8, '...'),
|
||||
array('Test...', 'Test foo bar', 7, '...'),
|
||||
array('...', 'Test foo bar', 4, '...'),
|
||||
array('T...', 'Test foo bar', 4, '...'),
|
||||
array('Test....', 'Test foo bar', 11, '....'),
|
||||
array('Test fòô bàř', 'Test fòô bàř', 12, '', 'UTF-8'),
|
||||
array('Test fòô', 'Test fòô bàř', 11, '', 'UTF-8'),
|
||||
array('Test fòô', 'Test fòô bàř', 8, '', 'UTF-8'),
|
||||
array('Test', 'Test fòô bàř', 7, '', 'UTF-8'),
|
||||
array('Test', 'Test fòô bàř', 4, '', 'UTF-8'),
|
||||
array('Test fòô bàř', 'Test fòô bàř', 12, 'ϰϰ', 'UTF-8'),
|
||||
array('Test fòôϰϰ', 'Test fòô bàř', 11, 'ϰϰ', 'UTF-8'),
|
||||
array('Testϰϰ', 'Test fòô bàř', 8, 'ϰϰ', 'UTF-8'),
|
||||
array('Testϰϰ', 'Test fòô bàř', 7, 'ϰϰ', 'UTF-8'),
|
||||
array('ϰϰ', 'Test fòô bàř', 4, 'ϰϰ', 'UTF-8'),
|
||||
array('Tëst fòô bàř', 'Tëst fòô bàř', 12, '', 'UTF-8'),
|
||||
array('Tëst fòô', 'Tëst fòô bàř', 11, '', 'UTF-8'),
|
||||
array('Tëst fòô', 'Tëst fòô bàř', 8, '', 'UTF-8'),
|
||||
array('Tëst', 'Tëst fòô bàř', 7, '', 'UTF-8'),
|
||||
array('Tëst', 'Tëst fòô bàř', 4, '', 'UTF-8'),
|
||||
array('Tëst fòô bàř', 'Tëst fòô bàř', 12, 'ϰϰ', 'UTF-8'),
|
||||
array('Tëst fòôϰϰ', 'Tëst fòô bàř', 11, 'ϰϰ', 'UTF-8'),
|
||||
array('Tëstϰϰ', 'Tëst fòô bàř', 8, 'ϰϰ', 'UTF-8'),
|
||||
array('Tëstϰϰ', 'Tëst fòô bàř', 7, 'ϰϰ', 'UTF-8'),
|
||||
array('Tëϰϰ', 'Tëst fòô bàř', 4, 'ϰϰ', 'UTF-8'),
|
||||
array('What are your plans...', 'What are your plans today?', 22, '...')
|
||||
);
|
||||
}
|
||||
@@ -1729,6 +1787,36 @@ class StringyTestCase extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider stripWhitespaceProvider()
|
||||
*/
|
||||
public function testStripWhitespace($expected, $str, $encoding = null)
|
||||
{
|
||||
$stringy = S::create($str, $encoding);
|
||||
$result = $stringy->stripWhitespace();
|
||||
$this->assertStringy($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
$this->assertEquals($str, $stringy);
|
||||
}
|
||||
|
||||
public function stripWhitespaceProvider()
|
||||
{
|
||||
return array(
|
||||
array('foobar', ' foo bar '),
|
||||
array('teststring', 'test string'),
|
||||
array('Οσυγγραφέας', ' Ο συγγραφέας '),
|
||||
array('123', ' 123 '),
|
||||
array('', ' ', 'UTF-8'), // no-break space (U+00A0)
|
||||
array('', ' ', 'UTF-8'), // spaces U+2000 to U+200A
|
||||
array('', ' ', 'UTF-8'), // narrow no-break space (U+202F)
|
||||
array('', ' ', 'UTF-8'), // medium mathematical space (U+205F)
|
||||
array('', ' ', 'UTF-8'), // ideographic space (U+3000)
|
||||
array('123', ' 1 2 3 ', 'UTF-8'),
|
||||
array('', ' '),
|
||||
array('', ''),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider substrProvider()
|
||||
*/
|
||||
@@ -2066,7 +2154,13 @@ class StringyTestCase extends PHPUnit_Framework_TestCase
|
||||
public function isJsonProvider()
|
||||
{
|
||||
return array(
|
||||
array(true, ''),
|
||||
array(false, ''),
|
||||
array(false, ' '),
|
||||
array(true, 'null'),
|
||||
array(true, 'true'),
|
||||
array(true, 'false'),
|
||||
array(true, '[]'),
|
||||
array(true, '{}'),
|
||||
array(true, '123'),
|
||||
array(true, '{"foo": "bar"}'),
|
||||
array(false, '{"foo":"bar",}'),
|
||||
@@ -2164,6 +2258,31 @@ class StringyTestCase extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider isBase64Provider()
|
||||
*/
|
||||
public function testIsBase64($expected, $str)
|
||||
{
|
||||
$stringy = S::create($str);
|
||||
$result = $stringy->isBase64();
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertEquals($expected, $result);
|
||||
$this->assertEquals($str, $stringy);
|
||||
}
|
||||
|
||||
public function isBase64Provider()
|
||||
{
|
||||
return array(
|
||||
array(false, ' '),
|
||||
array(true, ''),
|
||||
array(true, base64_encode('FooBar') ),
|
||||
array(true, base64_encode(' ') ),
|
||||
array(true, base64_encode('FÒÔBÀŘ') ),
|
||||
array(true, base64_encode('συγγραφέας') ),
|
||||
array(false, 'Foobar'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider isUpperCaseProvider()
|
||||
*/
|
||||
@@ -2343,6 +2462,7 @@ class StringyTestCase extends PHPUnit_Framework_TestCase
|
||||
array('foo', 'bar', '[[:alpha:]]{3}', 'foo'),
|
||||
array('', '', '', '', 'msr', 'UTF-8'),
|
||||
array('bàř', 'fòô ', 'f[òô]+\s', 'bàř', 'msr', 'UTF-8'),
|
||||
array('fòô', 'fò', '(ò)', '\\1ô', 'msr', 'UTF-8'),
|
||||
array('fòô', 'bàř', '[[:alpha:]]{3}', 'fòô', 'msr', 'UTF-8')
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user