[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/php-ai-client/src/Common/ -> AbstractDataTransferObject.php (summary)

Abstract base class for all Data Value Objects in the AI Client. This abstract class consolidates the common functionality needed by all data transfer objects: - Array transformation for data manipulation - JSON schema support for validation and documentation - JSON serialization with proper empty object handling

File Size: 128 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 4 functions

  validateFromArrayData()
  isArrayShape()
  jsonSerialize()
  convertEmptyArraysToObjects()

Functions
Functions that are not part of a class:

validateFromArrayData(array $data, array $requiredKeys)   X-Ref
Validates that required keys exist in the array data.

param: array<mixed> $data The array data to validate.
param: string[] $requiredKeys The keys that must be present.

isArrayShape(array $array)   X-Ref
{@inheritDoc}


jsonSerialize()   X-Ref
Converts the object to a JSON-serializable format.

This method uses the toArray() method and then processes the result
based on the JSON schema to ensure proper object representation for
empty arrays.

return: mixed The JSON-serializable representation.

convertEmptyArraysToObjects($data, array $schema)   X-Ref
Recursively converts empty arrays to stdClass objects where the schema expects objects.

return: mixed The processed data.
param: mixed $data The data to process.
param: array<mixed, mixed> $schema The JSON schema for the data.



Generated : Sat Jun 13 09:38:55 2026 Cross-referenced by PHPXref