eee
This commit is contained in:
@@ -37,13 +37,6 @@ class Kiri
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Container|null
|
||||
*/
|
||||
public static function getContainerContext(): ?Container
|
||||
{
|
||||
return static::getContainer();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -131,17 +124,6 @@ class Kiri
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function isDocker(): bool
|
||||
{
|
||||
$output = shell_exec('[ -f /.dockerenv ] && echo yes || echo no');
|
||||
if (trim($output) === 'yes') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -177,54 +159,6 @@ class Kiri
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public static function localhost(): mixed
|
||||
{
|
||||
return current(swoole_get_local_ip());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $v1
|
||||
* @param array $v2
|
||||
* @return float
|
||||
*/
|
||||
#[Pure] public static function distance(array $v1, array $v2): float
|
||||
{
|
||||
$maxX = max($v1['x'], $v2['x']);
|
||||
$minX = min($v1['x'], $v2['x']);
|
||||
|
||||
$maxZ = max($v1['z'], $v2['z']);
|
||||
$minZ = min($v1['z'], $v2['z']);
|
||||
|
||||
$dx = abs($maxX - $minX);
|
||||
$dy = abs($maxZ - $minZ);
|
||||
|
||||
$sqrt = sqrt($dx * $dx + $dy * $dy);
|
||||
if ($sqrt < 0) {
|
||||
$sqrt = abs($sqrt);
|
||||
}
|
||||
return (float)$sqrt;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $tmp_name
|
||||
* @return string
|
||||
*/
|
||||
public static function rename($tmp_name): string
|
||||
{
|
||||
$hash = md5_file($tmp_name);
|
||||
|
||||
$later = '.' . exif_imagetype($tmp_name);
|
||||
|
||||
$match = '/(\w{12})(\w{5})(\w{9})(\w{6})/';
|
||||
$tmp = preg_replace($match, '$1-$2-$3-$4', $hash);
|
||||
|
||||
return strtoupper($tmp) . $later;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user