Generates a random PHP object.
int $size: The number of random keys to add to the object.
\stdClass The generated object, with the specified number of random keys. Each key has a random string value.
public static function randomObject($size = 4) {
$object = new \stdClass();
for ($i = 0; $i < $size; $i++) {
$random_key = self::randomName();
$random_value = self::randomString();
$object->{$random_key} = $random_value;
}
return $object;
}