2017-09-10 04:55:21 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Extensions;
|
|
|
|
|
|
|
|
use Hashids\Hashids as VendorHashids;
|
|
|
|
use Pterodactyl\Contracts\Extensions\HashidsInterface;
|
|
|
|
|
|
|
|
class Hashids extends VendorHashids implements HashidsInterface
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
2022-10-14 16:59:20 +00:00
|
|
|
public function decodeFirst(string $encoded, string $default = null): mixed
|
2017-09-10 04:55:21 +00:00
|
|
|
{
|
|
|
|
$result = $this->decode($encoded);
|
2021-01-23 20:33:34 +00:00
|
|
|
if (!is_array($result)) {
|
2017-09-10 04:55:21 +00:00
|
|
|
return $default;
|
|
|
|
}
|
|
|
|
|
|
|
|
return array_first($result, null, $default);
|
|
|
|
}
|
|
|
|
}
|