From eb92d695450fd51e23d928343d0c11226a20404d Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 29 Jan 2023 15:38:40 +0100 Subject: Actually fix sample gig data generator... --- generate-sample-gig-data.php | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 'generate-sample-gig-data.php') diff --git a/generate-sample-gig-data.php b/generate-sample-gig-data.php index 4ed9ac8..ecbf67a 100644 --- a/generate-sample-gig-data.php +++ b/generate-sample-gig-data.php @@ -1,9 +1,14 @@ -// SPDX-FileCopyrightText: 2021 Harald Eilertsen -// -// SPDX-License-Identifier: AGPL-3.0-or-later +/** + * Tool to generate random concert entries for importing into giglogadmin. + * + * @package giglogadmin + * + * SPDX-FileCopyrightText: 2021 Andrea Chirulescu + * SPDX-FileCopyrightText: 2021 Harald Eilertsen + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ /** * Abstract base class for a generator. @@ -195,16 +200,24 @@ class LinkGenerator extends GeneratorBase { */ class CityGenerator extends GeneratorBase { + /** + * A few cities, so we can test filtering for cities. + * + * @var array $cities The cities. + */ private array $cities = array( - "Oslo", - "Trondheim", - "Støren", - "Velstandsbygd", - "Sommerhytta" + 'Oslo', + 'Trondheim', + 'Støren', + 'Velstandsbygd', + 'Sommerhytta', ); - function get() : string { - return $this-pick( $cities ); + /** + * Return a random city. + */ + public function get() : string { + return $this->pick( $this->cities ); } } @@ -220,5 +233,6 @@ $num = intval( array_shift( $argv ) ) ?? 10; for ( $i = 0; $i < $num; $i++ ) { $date->add( new DateInterval( 'P' . random_int( 0, 60 ) . 'D' ) ); + // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped echo implode( "\t", array( $band->get(), $venue->get(), $city->get(), $date->format( 'Y-m-d' ), $links->get(), $links->get() ) ) . "\n"; } -- cgit v1.2.3