Index
-
\com\setasign\SetaFramework
-
Helper
- ArrayHelper
- ConsoleHelper
- CsrfProtection
- CsrfProtectionException
- DataWrapper
- DatabaseCleaner
- Debugging
- FilesystemHelper
- FunctionWrapper
- JsonHelper
- Logger
- LoggerHelper
- MathHelper
- ObserverClosure
- OutputBufferHelper
- ParameterSanitizer
- PregMatchAllMatchesIterator
- RateLimiter
- ReturnValueClosure
- StringHelper
- SwiftMailerHelper
- UnexpectedOutputException
- UnserializableClosure
-
Helper
com\setasign\SetaFramework\Helper
StringHelper Class StringHelper
File: /SetaFramework/src/Helper/StringHelper.php
Class hierarchy
Summary
Static Methods
contains()
WARNING: This method is marked as deprecated!
Use str_contains() instead.
Checks whether $haystack contains $needle.
Parameters
- $haystack : string
- $needle : string
endsWith()
WARNING: This method is marked as deprecated!
Use str_ends_with() instead.
Checks whether $haystack ends with $needle.
Parameters
- $haystack : string
- $needle : string
fromCamelCase()
string $delimiter = '-',
bool $ensureCamelcase = true
Converts a camel case string into kebab case (delimiter '-'), snake case (delimiter '_') or normal case (delimiter ' ') string.
Parameters
- $string : string
- $delimiter : string
- $ensureCamelcase : bool
prettyVarExport()
string $indent = '',
string $tab = ' '
Parameters
- $var : mixed
- $indent : string
- $tab : string
startsWith()
WARNING: This method is marked as deprecated!
Use str_starts_with() instead.
Checks whether $haystack starts with $needle.
Parameters
- $haystack : string
- $needle : string
toCamelCase()
Converts a string to camel case writing style
Parameters
- $string : string
- $lowerFirstChar : bool
toString()
?callable $catch = null,
string $fallback = ''
__toString methods must not throw an exception. This helper will catch all exceptions and ignore the errors.
Parameters
- $try : callable
- $catch : ?callable
If $catch is null and an exception is thrown an empty string will be returned.
- $fallback : string
Return value on error if $catch is null or throws an exception.
toStringErrorHandler()
?callable $catch = null,
string $fallback = '',
string $errorLevel = \Psr\Log\LogLevel::ERROR
__toString methods must not throw an exception.
This helper will catch all exceptions and add the exception to the catchedErrors of the errorHandler.
Parameters
- $try : callable
- $catch : ?callable
If $catch is null and an exception is thrown an empty string will be returned.
- $fallback : string
Return value on error if $catch is null or throws an exception.
- $errorLevel : string
Which error level should be used for the error if an error occurs.
