PHP Class Yosymfony\Spress\Core\Support\StringWrapper

Based on https://github.com/laravel/framework/blob/5.0/src/Illuminate/Support/Arr.php and https://github.com/danielstjules/Stringy/blob/master/src/Stringy.php
Author: Victor Puertas ([email protected])
显示文件 Open project: spress/spress Class Usage Examples

Protected Properties

Property Type Description
$chars
$str

Public Methods

Method Description
__construct ( string $str = '' ) Constructor.
__toString ( ) : string Returns the string wrapped.
deletePrefix ( string $prefix ) : string Deletes a prefix of the string.
deleteSufix ( string $sufix ) : string Deletes a sufix of the string.
endWith ( string $value ) : boolean Determine if a the string ends with a given substring.
getFirstEndMatch ( array $strings ) : string Gets the first element of the argument matching with the ends of the string.
lower ( ) : string Convert the given string to lower-case.
setString ( string $str ) : Yosymfony\Spress\Core\Support Sets the string.
slug ( string $separator = '-' ) : string Generate a URL friendly "slug".
startWith ( string $value ) : boolean Determine if a the string starts with a given substring.
toAscii ( boolean $removeUnsupported = true ) : string Transliterate a UTF-8 value to ASCII.
upper ( ) : string Convert the given string to upper-case.

Protected Methods

Method Description
getChars ( ) : array Gets the conversion table.

Method Details

__construct() public method

Constructor.
public __construct ( string $str = '' )
$str string The string

__toString() public method

Returns the string wrapped.
public __toString ( ) : string
return string The current value of the wrapper

deletePrefix() public method

Deletes a prefix of the string.
public deletePrefix ( string $prefix ) : string
$prefix string The prefix
return string The string without prefix

deleteSufix() public method

Deletes a sufix of the string.
public deleteSufix ( string $sufix ) : string
$sufix string The sufix
return string The string without sufix

endWith() public method

Determine if a the string ends with a given substring.
public endWith ( string $value ) : boolean
$value string
return boolean

getChars() protected method

Gets the conversion table.
protected getChars ( ) : array
return array

getFirstEndMatch() public method

Gets the first element of the argument matching with the ends of the string.
public getFirstEndMatch ( array $strings ) : string
$strings array List of strings
return string The first element or empty string if no matching found

lower() public method

Convert the given string to lower-case.
public lower ( ) : string
return string

setString() public method

Sets the string.
public setString ( string $str ) : Yosymfony\Spress\Core\Support
$str string The string
return Yosymfony\Spress\Core\Support This instance

slug() public method

Generate a URL friendly "slug".
public slug ( string $separator = '-' ) : string
$separator string
return string

startWith() public method

Determine if a the string starts with a given substring.
public startWith ( string $value ) : boolean
$value string
return boolean

toAscii() public method

Transliterate a UTF-8 value to ASCII.
public toAscii ( boolean $removeUnsupported = true ) : string
$removeUnsupported boolean Whether or not to remove the unsupported characters
return string

upper() public method

Convert the given string to upper-case.
public upper ( ) : string
return string

Property Details

$chars protected_oe property

protected $chars

$str protected_oe property

protected $str