diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2023-01-29 15:38:40 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2023-01-29 15:38:40 +0100 |
commit | eb92d695450fd51e23d928343d0c11226a20404d (patch) | |
tree | 0b37ae4353bbc56442d77fba3421efe9cbfb40eb /generate-sample-gig-data.php | |
parent | 8b6999b5bf0e8889bf81681ba9f8067ff4decfce (diff) | |
download | gigologadmin-eb92d695450fd51e23d928343d0c11226a20404d.tar.gz gigologadmin-eb92d695450fd51e23d928343d0c11226a20404d.tar.bz2 gigologadmin-eb92d695450fd51e23d928343d0c11226a20404d.zip |
Actually fix sample gig data generator...
Diffstat (limited to 'generate-sample-gig-data.php')
-rw-r--r-- | generate-sample-gig-data.php | 38 |
1 files changed, 26 insertions, 12 deletions
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 @@ <?php - -// SPDX-FileCopyrightText: 2021 Andrea Chirulescu <andrea.chirulescu@gmail.com> -// SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net> -// -// 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 <andrea.chirulescu@gmail.com> + * SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net> + * + * 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"; } |