| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
/* |
| 6 |
* The MIT License (MIT) |
| 7 |
* |
| 8 |
* Copyright (c) 2014-2021 Spomky-Labs |
| 9 |
* |
| 10 |
* This software may be modified and distributed under the terms |
| 11 |
* of the MIT license. See the LICENSE file for details. |
| 12 |
*/ |
| 13 |
|
| 14 |
namespace Webauthn\MetadataService; |
| 15 |
|
| 16 |
use LogicException; |
| 17 |
use Throwable; |
| 18 |
|
| 19 |
/** |
| 20 |
* @internal |
| 21 |
*/ |
| 22 |
abstract class Utils |
| 23 |
{ |
| 24 |
public static function logicException(string $message, ?Throwable $previousException = null): callable |
| 25 |
{ |
| 26 |
return static function () use ($message, $previousException): LogicException { |
| 27 |
return new LogicException($message, 0, $previousException); |
| 28 |
}; |
| 29 |
} |
| 30 |
|
| 31 |
public static function filterNullValues(array $data): array |
| 32 |
{ |
| 33 |
return array_filter($data, static function ($var): bool {return null !== $var; }); |
| 34 |
} |
| 35 |
} |
| 36 |
|