Implement client session management and refactoring
This commit is contained in:
parent
cad2ea3419
commit
3a10e01bd8
11 changed files with 234 additions and 23 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Socialbox\Classes;
|
||||
|
||||
use DateTime;
|
||||
use InvalidArgumentException;
|
||||
use JsonException;
|
||||
use RuntimeException;
|
||||
|
@ -170,4 +171,25 @@ class Utilities
|
|||
|
||||
return $randomString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a random CRC32 hash.
|
||||
*
|
||||
* @return string The generated CRC32 hash as a string.
|
||||
*/
|
||||
public static function randomCrc32(): string
|
||||
{
|
||||
return hash('crc32b', uniqid());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitizes a file name by removing any characters that are not alphanumeric, hyphen, or underscore.
|
||||
*
|
||||
* @param string $name The file name to be sanitized.
|
||||
* @return string The sanitized file name.
|
||||
*/
|
||||
public static function sanitizeFileName(string $name): string
|
||||
{
|
||||
return preg_replace('/[^a-zA-Z0-9-_]/', '', $name);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue