2022-10-10 11:21:42 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Helpers;
|
|
|
|
|
|
|
|
use Illuminate\Support\Str;
|
|
|
|
|
|
|
|
class Helpers
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Generate a unique filename
|
|
|
|
*
|
2022-10-12 11:13:13 +02:00
|
|
|
* @param string $extension
|
2022-10-10 11:21:42 +02:00
|
|
|
* @return string The filename
|
|
|
|
*/
|
|
|
|
public static function getUniqueFilename(string $extension): string
|
|
|
|
{
|
|
|
|
return Str::random(40).'.'.$extension;
|
|
|
|
}
|
2022-10-12 11:10:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
public static function cleanVersionNumber(?string $release): string|false
|
|
|
|
{
|
|
|
|
return preg_match('/([[0-9][0-9\.]*[0-9])/', $release, $version) ? $version[0] : false;
|
|
|
|
}
|
2022-10-10 11:21:42 +02:00
|
|
|
}
|