mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-12-15 07:33:36 +08:00
21 lines
589 B
PHP
21 lines
589 B
PHP
<?php
|
|
|
|
namespace BookStack\Exports\ZipExportModels;
|
|
|
|
use JsonSerializable;
|
|
|
|
abstract class ZipExportModel implements JsonSerializable
|
|
{
|
|
/**
|
|
* Handle the serialization to JSON.
|
|
* For these exports, we filter out optional (represented as nullable) fields
|
|
* just to clean things up and prevent confusion to avoid null states in the
|
|
* resulting export format itself.
|
|
*/
|
|
public function jsonSerialize(): array
|
|
{
|
|
$publicProps = get_object_vars(...)->__invoke($this);
|
|
return array_filter($publicProps, fn ($value) => $value !== null);
|
|
}
|
|
}
|