PHP 클래스 VersionPress\Utils\StringUtils

파일 보기 프로젝트 열기: versionpress/versionpress 1 사용 예제들

공개 메소드들

메소드 설명
crlfize ( string $str ) : string Converts LF string to CRLF string
fillTemplateString ( array $variables, string $templateString ) : string Fills template string placeholders with variables provided in $variables array.
isSerializedValue ( $value ) : boolean Returns true if string is a serialized value (object, array, primitive types, .
pluralize ( string $string ) : string Converts given noun to plural form.
replaceFirst ( string $needle, string $replace, string $haystack ) : string Replaces the first occurence.
substringFromTo ( string $str, integer $from, integer $to ) : string An alternative to the built-in PHP function substr.
verbToPastTense ( string $verb ) : string Converts given verb to past sense. E.g., "install" -> "installed", "activate" -> "activated" etc.

메소드 상세

crlfize() 공개 정적인 메소드

Converts LF string to CRLF string
public static crlfize ( string $str ) : string
$str string LF line endings
리턴 string CRLF line endings

fillTemplateString() 공개 정적인 메소드

Placeholders pattern: {{variable-name}}
public static fillTemplateString ( array $variables, string $templateString ) : string
$variables array associative array with keys as variable names.
$templateString string template string which contains placeholders for variables to be expanded.
리턴 string templateString with expanded variable placeholders

isSerializedValue() 공개 정적인 메소드

..).
public static isSerializedValue ( $value ) : boolean
$value
리턴 boolean

pluralize() 공개 정적인 메소드

Note: It's very, very simplified! From: https://gist.github.com/tbrianjones/ba0460cc1d55f357e00b
public static pluralize ( string $string ) : string
$string string
리턴 string

replaceFirst() 공개 정적인 메소드

Replaces the first occurence.
public static replaceFirst ( string $needle, string $replace, string $haystack ) : string
$needle string
$replace string
$haystack string
리턴 string

substringFromTo() 공개 정적인 메소드

The substr function needs the length of substring. This method takes bounds from-to.
public static substringFromTo ( string $str, integer $from, integer $to ) : string
$str string
$from integer
$to integer
리턴 string

verbToPastTense() 공개 정적인 메소드

Converts given verb to past sense. E.g., "install" -> "installed", "activate" -> "activated" etc.
public static verbToPastTense ( string $verb ) : string
$verb string
리턴 string