diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2019-01-04 12:43:06 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2019-01-04 12:43:28 +0000 |
| commit | f24adca2d962c9962cf8af5a837b10d27fc635c1 (patch) | |
| tree | 67ff6fed4fd422c2848743be0ed4ab984021b3b1 /app/GedcomTag.php | |
| parent | 60e5624e9953d95b678d6087405463b3e6ab69d6 (diff) | |
| download | webtrees-f24adca2d962c9962cf8af5a837b10d27fc635c1.tar.gz webtrees-f24adca2d962c9962cf8af5a837b10d27fc635c1.tar.bz2 webtrees-f24adca2d962c9962cf8af5a837b10d27fc635c1.zip | |
Use constant arrays instead of static variables
Diffstat (limited to 'app/GedcomTag.php')
| -rw-r--r-- | app/GedcomTag.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/GedcomTag.php b/app/GedcomTag.php index 4cfa3b581d..1dc3c3b7a0 100644 --- a/app/GedcomTag.php +++ b/app/GedcomTag.php @@ -24,8 +24,8 @@ use Ramsey\Uuid\Uuid; */ class GedcomTag { - /** @var string[] All tags that webtrees knows how to translate - including special/internal tags */ - private static $ALL_TAGS = [ + /** All tags that webtrees knows how to translate - including special/internal tags */ + private const ALL_TAGS = [ 'ABBR', 'ADDR', 'ADR1', @@ -398,7 +398,7 @@ class GedcomTag ]; /** @var string[] Possible values for the Object-File-Format types */ - private static $OBJE_FILE_FORM_TYPE = [ + private const OBJE_FILE_FORM_TYPE = [ 'audio', 'book', 'card', @@ -428,7 +428,7 @@ class GedcomTag */ public static function isTag($tag): bool { - return in_array($tag, self::$ALL_TAGS); + return in_array($tag, self::ALL_TAGS); } /** @@ -2411,10 +2411,10 @@ class GedcomTag */ public static function getFileFormTypes(): array { - $values = []; - foreach (self::$OBJE_FILE_FORM_TYPE as $type) { - $values[$type] = self::getFileFormTypeValue($type); - } + $values = array_map(function (string $keyword): string { + return self::getFileFormTypeValue($keyword); + }, self::OBJE_FILE_FORM_TYPE); + uasort($values, '\Fisharebest\Webtrees\I18N::strcasecmp'); return $values; |
