Function Database_Static_xml->_read_record

Definitions

sources/database/xml.php

  • Read a record from an XML file.
  • Visibility: protected
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$path PATH No No required parameter N/A N/A The file path
$schema ?array No No Null N/A N/A Schema to type-set against (null: do not do type-setting)
$must_contain_strings array No No [] N/A N/A Substrings to check it is in, used for performance
$include_unused_fields boolean No No False N/A N/A Whether to include fields that are present in the actual records but not in our schema
$fail_ok boolean No No False N/A N/A Whether to not output an error on some kind of run-time failure (parse errors and clear programming errors are always fatal)

Returns

  • The record map (null: does not contain requested substrings / error)
  • Type: ?array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Read a record from an XML file.
 *
 * @param  PATH $path The file path
 * @param  ?array $schema Schema to type-set against (null: do not do type-setting)
 * @param  array $must_contain_strings Substrings to check it is in, used for performance
 * @param  boolean $include_unused_fields Whether to include fields that are present in the actual records but not in our schema
 * @param  boolean $fail_ok Whether to not output an error on some kind of run-time failure (parse errors and clear programming errors are always fatal)
 * @return ?array The record map (null: does not contain requested substrings / error)
 */

protected function _read_record(string $path, ?array $schema = null, array $must_contain_strings = [], bool $include_unused_fields = false, bool $fail_ok = false) : ?array