protected function AddressEventsSubscriber::getRandomAddress in Commerce Demo 8
Gets a random address value.
Return value
array
1 call to AddressEventsSubscriber::getRandomAddress()
- AddressEventsSubscriber::onInitialValues in src/
EventSubscriber/ AddressEventsSubscriber.php - Alters the initial values.
File
- src/
EventSubscriber/ AddressEventsSubscriber.php, line 37
Class
Namespace
Drupal\commerce_demo\EventSubscriberCode
protected function getRandomAddress() {
$addresses = [
[
'given_name' => 'Celia',
'family_name' => 'Engeseth',
'address_line1' => '8502 Pilgrim St.',
'locality' => 'Mokena',
'administrative_area' => 'IL',
'postal_code' => '60448',
],
[
'given_name' => 'Josefine',
'family_name' => 'Christiansen',
'address_line1' => '7691 East 6th St',
'locality' => 'Lewiston',
'administrative_area' => 'ME',
'postal_code' => '04240',
],
[
'given_name' => 'Oliver',
'family_name' => 'Mantyla',
'address_line1' => '315 Addison Court ',
'locality' => 'New Windsor',
'administrative_area' => 'NY',
'postal_code' => '12553',
],
[
'given_name' => 'Heinz Dieter',
'family_name' => 'Reinke',
'address_line1' => '45 Bow Ridge Ave',
'locality' => 'West Chicago',
'administrative_area' => 'IL',
'postal_code' => '60185',
],
];
return $addresses[array_rand($addresses)];
}