Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. BaseConstraint.php

function BaseConstraint::arrayToObjectRecursive

Recursively cast an associative array to an object

Parameters

array $array:

Return value

object

3 calls to BaseConstraint::arrayToObjectRecursive()
SchemaConstraint::check in vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php
invokes the validation of an element
SchemaStorage::addSchema in vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.php
Adds schema with given identifier
Validator::validate in vendor/justinrainbow/json-schema/src/JsonSchema/Validator.php
Validates the given data against the schema and returns an object containing the results Both the php object and the schema are supposed to be a result of a json_decode call. The validation works as defined by the schema proposal in…

File

vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php, line 135

Class

BaseConstraint
A more basic constraint definition - used for the public interface to avoid exposing library internals.

Namespace

JsonSchema\Constraints

Code

public static function arrayToObjectRecursive($array) {
    $json = json_encode($array);
    if (json_last_error() !== \JSON_ERROR_NONE) {
        $message = 'Unable to encode schema array as JSON';
        if (function_exists('json_last_error_msg')) {
            $message .= ': ' . json_last_error_msg();
        }
        throw new InvalidArgumentException($message);
    }
    return (object) json_decode($json);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal