function Random::object

Same name in this branch
  1. 11.x core/lib/Drupal/Component/Utility/Random.php \Drupal\Component\Utility\Random::object()
Same name in other branches
  1. 9 core/lib/Drupal/Component/Utility/Random.php \Drupal\Component\Utility\Random::object()
  2. 8.9.x core/lib/Drupal/Component/Utility/Random.php \Drupal\Component\Utility\Random::object()
  3. 10 core/tests/Drupal/TestTools/Random.php \Drupal\TestTools\Random::object()
  4. 10 core/lib/Drupal/Component/Utility/Random.php \Drupal\Component\Utility\Random::object()

Generates a random PHP object.

Parameters

int $size: The number of random keys to add to the object.

Return value

object The generated object, with the specified number of random keys. Each key has a random string value.

See also

\Drupal\Component\Utility\Random::object()

1 call to Random::object()
RandomGeneratorTrait::randomObject in core/tests/Drupal/Tests/RandomGeneratorTrait.php
Generates a random PHP object.

File

core/tests/Drupal/TestTools/Random.php, line 121

Class

Random
Provides random generator utility static methods.

Namespace

Drupal\TestTools

Code

public static function object(int $size = 4) : \stdClass {
    return static::getGenerator()->object($size);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.