\Ceo\Core\UtilStringUtil

CEO String utilities

None of these should be considered cryptographically secure. Yo.

Summary

Methods
Properties
Constants
uuid()
random()
parseSrn()
sluggify()
htmlPurify()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

uuid()

uuid() : string

Generate a (hopefully) unique, time-based UUID

Returns

string —

UUID

random()

random(integer  $length = 25, string  $prefix = '',   $type = null) : string

Generate random string of a fixed length. Only uses alpha-numeric characters.

Parameters

integer $length

string length

string $prefix

string prefix, does not count toward total length

$type

Returns

string

parseSrn()

parseSrn(string  $srn) : array

Parse a SRN into its component parts. Returns an array with: * client * appid * resource * uuid * extra

Example:

    use Ceo\Core\Util\String;

    var_export(String::parseSrn('srn:tsn:ceo-core/user:ec3f361b-6ca7-4d97-8970-099ea4b19419'));

Would give you:

    [
        'client'     => 'tsn',
        'appid'      => 'ceo-core',
        'resource'   => 'user',
        'uuid'       => 'ec3f361b-6ca7-4d97-8970-099ea4b19419',
        'extra'      => ''
    ]

Parameters

string $srn

Returns

array

sluggify()

sluggify(string  $str,   $delim = '-') : string

Generate slugs

Internally, just uses Phalcon\Utils\Slug;

Parameters

string $str

string to sluggify

$delim

Returns

string —

slugged string

htmlPurify()

htmlPurify(string  $str) : string

Run dirty html *fragments* through the purifier

In theory, is HTML5 compliant

Parameters

string $str

HTML fragment

Returns

string —

cleaned fragment