From 9ca2ee4cb4679e68ec832f89d36af0606334743c Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 29 Jan 2023 13:37:58 +0100 Subject: Add cities to the generated sample data + capitalization --- generate-sample-gig-data.php | 84 +++++++++++++++++++++++++++----------------- 1 file changed, 52 insertions(+), 32 deletions(-) diff --git a/generate-sample-gig-data.php b/generate-sample-gig-data.php index 19eaffc..4ed9ac8 100644 --- a/generate-sample-gig-data.php +++ b/generate-sample-gig-data.php @@ -52,14 +52,14 @@ class BandNameGenerator extends GeneratorBase { * @psalm-var array{0: string, 1: string, 2: string, 3: string, 4: string, 5: string, 6: string, 7: string} */ private array $adverbs = array( - 'bestial', - 'dead', - 'incongruent', - 'ladylike', - 'slimy', - 'dandy', - 'leftist', - 'flamboyant', + 'Bestial', + 'Dead', + 'Incongruent', + 'Ladylike', + 'Slimy', + 'Dandy', + 'Leftist', + 'Flamboyant', ); /** @@ -70,13 +70,13 @@ class BandNameGenerator extends GeneratorBase { * @psalm-var array{0: string, 1: string, 2: string, 3: string, 4: string, 5: string, 6: string} */ private array $verbs = array( - 'kill', - 'regurgitat', - 'destroy', - 'blasphem', - 'strangl', - 'terroriz', - 'mutilat', + 'Kill', + 'Regurgitat', + 'Destroy', + 'Blasphem', + 'Strangl', + 'Terroriz', + 'Mutilat', ); /** @@ -91,6 +91,7 @@ class BandNameGenerator extends GeneratorBase { 'ers', 'ing', 'ed', + 'or', ); /** @@ -121,10 +122,10 @@ class VenueGenerator extends GeneratorBase { */ private array $prefix1 = array( '', - 'royal', - 'shabby', - 'happy', - 'drunken', + 'Royal', + 'Shabby', + 'Happy', + 'Drunken', ); /** @@ -136,11 +137,11 @@ class VenueGenerator extends GeneratorBase { */ private array $prefix2 = array( '', - 'music', - 'fiddler', - 'rock', - 'metal', - 'mental', + 'Music', + 'Fiddler', + 'Rock', + 'Metal', + 'Mental', ); /** @@ -151,13 +152,13 @@ class VenueGenerator extends GeneratorBase { * @psalm-var array{0: string, 1: string, 2: string, 3: string, 4: string, 5: string, 6: string} */ private array $type = array( - 'hall', - 'museum', - 'asylum', - 'stage', - 'cottage', - 'opera', - 'lighthouse', + 'Hall', + 'Museum', + 'Asylum', + 'Stage', + 'Cottage', + 'Opera', + 'Lighthouse', ); /** @@ -189,9 +190,28 @@ class LinkGenerator extends GeneratorBase { } } +/** + * Generator for cities + */ +class CityGenerator extends GeneratorBase { + + private array $cities = array( + "Oslo", + "Trondheim", + "Støren", + "Velstandsbygd", + "Sommerhytta" + ); + + function get() : string { + return $this-pick( $cities ); + } +} + $band = new BandNameGenerator(); $venue = new VenueGenerator(); $links = new LinkGenerator(); +$city = new CityGenerator(); $date = new DateTime(); $prog = array_shift( $argv ); @@ -200,5 +220,5 @@ $num = intval( array_shift( $argv ) ) ?? 10; for ( $i = 0; $i < $num; $i++ ) { $date->add( new DateInterval( 'P' . random_int( 0, 60 ) . 'D' ) ); - echo implode( "\t", array( $band->get(), $venue->get(), "Oslo", $date->format( 'Y-m-d' ), $links->get(), $links->get() ) ) . "\n"; + echo implode( "\t", array( $band->get(), $venue->get(), $city->get(), $date->format( 'Y-m-d' ), $links->get(), $links->get() ) ) . "\n"; } -- cgit v1.2.3