Documentation

Str
in package

FinalYes
Tags
author

Javier Eguiluz javier.eguiluz@gmail.com

author

Ryan Weaver weaverryan@gmail.com

Table of Contents

Properties

$inflector  : Inflector|null

Methods

addSuffix()  : string
Ensures that the given string ends with the given suffix. If the string already contains the suffix, it's not added twice. It's case-insensitive (e.g. value: 'Foocommand' suffix: 'Command' -> result: 'FooCommand').
areClassesAlphabetical()  : bool
asCamelCase()  : string
asClassName()  : string
Transforms the given string into the format commonly used by PHP classes, (e.g. `app:do_this-and_that` -> `AppDoThisAndThat`) but it doesn't check the validity of the class name.
asCommand()  : string
asEventMethod()  : string
asFilePath()  : string
asHumanWords()  : string
asLowerCamelCase()  : string
asRouteName()  : string
asRoutePath()  : string
asSnakeCase()  : string
asTwigVariable()  : string
Transforms the given string into the format commonly used by Twig variables (e.g. `BlogPostType` -> `blog_post_type`).
getNamespace()  : string
getRandomTerm()  : string
getShortClassName()  : string
hasSuffix()  : bool
Looks for suffixes in strings in a case-insensitive way.
isValidPhpVariableName()  : bool
Checks if the given name is a valid PHP variable name.
pluralCamelCaseToSingular()  : string
removeSuffix()  : string
Ensures that the given string doesn't end with the given suffix. If the string contains the suffix multiple times, only the last one is removed.
singularCamelCaseToPluralCamelCase()  : string
getInflector()  : Inflector
pluralize()  : string
singularize()  : string

Properties

Methods

addSuffix()

Ensures that the given string ends with the given suffix. If the string already contains the suffix, it's not added twice. It's case-insensitive (e.g. value: 'Foocommand' suffix: 'Command' -> result: 'FooCommand').

public static addSuffix(string $value, string $suffix) : string
Parameters
$value : string
$suffix : string
Return values
string

areClassesAlphabetical()

public static areClassesAlphabetical(string $class1, string $class2) : bool
Parameters
$class1 : string
$class2 : string
Return values
bool

asCamelCase()

public static asCamelCase(string $str) : string
Parameters
$str : string
Return values
string

asClassName()

Transforms the given string into the format commonly used by PHP classes, (e.g. `app:do_this-and_that` -> `AppDoThisAndThat`) but it doesn't check the validity of the class name.

public static asClassName(string $value[, string $suffix = '' ]) : string
Parameters
$value : string
$suffix : string = ''
Return values
string

asCommand()

public static asCommand(string $value) : string
Parameters
$value : string
Return values
string

asEventMethod()

public static asEventMethod(string $eventName) : string
Parameters
$eventName : string
Return values
string

asFilePath()

public static asFilePath(string $value) : string
Parameters
$value : string
Return values
string

asHumanWords()

public static asHumanWords(string $variableName) : string
Parameters
$variableName : string
Return values
string

asLowerCamelCase()

public static asLowerCamelCase(string $str) : string
Parameters
$str : string
Return values
string

asRouteName()

public static asRouteName(string $value) : string
Parameters
$value : string
Return values
string

asRoutePath()

public static asRoutePath(string $value) : string
Parameters
$value : string
Return values
string

asSnakeCase()

public static asSnakeCase(string $value) : string
Parameters
$value : string
Return values
string

asTwigVariable()

Transforms the given string into the format commonly used by Twig variables (e.g. `BlogPostType` -> `blog_post_type`).

public static asTwigVariable(string $value) : string
Parameters
$value : string
Return values
string

getNamespace()

public static getNamespace(string $fullClassName) : string
Parameters
$fullClassName : string
Return values
string

getRandomTerm()

public static getRandomTerm() : string
Return values
string

getShortClassName()

public static getShortClassName(string $fullClassName) : string
Parameters
$fullClassName : string
Return values
string

hasSuffix()

Looks for suffixes in strings in a case-insensitive way.

public static hasSuffix(string $value, string $suffix) : bool
Parameters
$value : string
$suffix : string
Return values
bool

pluralCamelCaseToSingular()

public static pluralCamelCaseToSingular(string $camelCase) : string
Parameters
$camelCase : string
Return values
string

removeSuffix()

Ensures that the given string doesn't end with the given suffix. If the string contains the suffix multiple times, only the last one is removed.

public static removeSuffix(string $value, string $suffix) : string

It's case-insensitive (e.g. value: 'Foocommand' suffix: 'Command' -> result: 'Foo'.

Parameters
$value : string
$suffix : string
Return values
string

singularCamelCaseToPluralCamelCase()

public static singularCamelCaseToPluralCamelCase(string $camelCase) : string
Parameters
$camelCase : string
Return values
string

pluralize()

private static pluralize(string $word) : string
Parameters
$word : string
Return values
string

singularize()

private static singularize(string $word) : string
Parameters
$word : string
Return values
string

        
On this page

Search results