mirror of
https://github.com/pestphp/pest.git
synced 2026-03-07 16:27:23 +01:00
Merge branch '4.x' into fix/sibling-describe-blocks
This commit is contained in:
@ -13,12 +13,9 @@ final class Str
|
||||
* Pool of alpha-numeric characters for generating (unsafe) random strings
|
||||
* from.
|
||||
*/
|
||||
private const POOL = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
private const string POOL = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const PREFIX = '__pest_evaluable_';
|
||||
private const string PREFIX = '__pest_evaluable_';
|
||||
|
||||
/**
|
||||
* Create a (unsecure & non-cryptographically safe) random alpha-numeric
|
||||
@ -120,4 +117,14 @@ final class Str
|
||||
{
|
||||
return (bool) filter_var($value, FILTER_VALIDATE_URL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the given `$target` to a URL-friendly "slug".
|
||||
*/
|
||||
public static function slugify(string $target): string
|
||||
{
|
||||
$target = preg_replace('/[^a-zA-Z0-9]+/', '-', $target);
|
||||
|
||||
return strtolower(trim((string) $target, '-'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user