mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-01-24 07:08:35 +01:00
31 lines
653 B
PHP
31 lines
653 B
PHP
<?php
|
|
|
|
namespace App\Helpers;
|
|
|
|
use Illuminate\Support\Str;
|
|
|
|
class Helpers
|
|
{
|
|
/**
|
|
* Generate a unique filename
|
|
*
|
|
* @param string $extension
|
|
* @return string The filename
|
|
*/
|
|
public static function getUniqueFilename(string $extension) : string
|
|
{
|
|
return Str::random(40) . '.' . $extension;
|
|
}
|
|
|
|
/**
|
|
* Clean a version number string
|
|
*
|
|
* @param string|null $release
|
|
* @return string|false
|
|
*/
|
|
public static function cleanVersionNumber(?string $release) : string|false
|
|
{
|
|
return preg_match('/([[0-9][0-9\.]*[0-9])/', $release, $version) ? $version[0] : false;
|
|
}
|
|
}
|