Files
Vari 1360bb7d44 Added updateMetadataGroup:
- Moved initOrGetGroup and updateMetadataGroup into own MetadataController.php becauseits really big and cluttered the PlayerController.php

- Added Challenges and pciked challenges for the characters

- Added that when the game sends us an update for the Character metadata, it automatically creates unknown challenges in the database and sets the picked challenges for this characterData
2024-02-26 11:23:59 +01:00

41 lines
1.1 KiB
PHP

<?php
namespace App\Helper\Uuid;
use Illuminate\Support\Collection;
use Ramsey\Uuid\Type\Hexadecimal;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidInterface;
abstract class UuidHelper
{
public static function convertFromUuidToHexCollection(Collection|array $collection, bool $uppercase = true): Collection {
$new = [];
foreach ($collection as $id) {
if($uppercase)
$new[] = strtoupper(Uuid::fromString($id)->getHex()->toString());
else
$new[] = Uuid::fromString($id)->getHex()->toString();
}
return collect($new);
}
/**
* @param Collection|array $collection
* @return Collection|UuidInterface[]
*/
public static function convertFromHexToUuidCollecton(Collection|array $collection, bool $toString = false): Collection {
$new = [];
foreach ($collection as $id) {
if($toString)
$new[] = Uuid::fromHexadecimal(new Hexadecimal($id))->toString();
else
$new[] = Uuid::fromHexadecimal(new Hexadecimal($id));
}
return collect($new);
}
}