TYPO3 v15 dev-main snapshot ()

This commit is contained in:
2026-08-10 22:31:09 +02:00
commit af8cc155b5
6818 changed files with 642608 additions and 0 deletions
+82
View File
@@ -0,0 +1,82 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Core\Country;
/**
* DTO that keeps the information about a country. Never instantiate directly,
* use CountryProvider instead.
*/
class Country
{
protected const LABEL_FILE = 'EXT:core/Resources/Private/Language/Iso/countries.xlf';
public function __construct(
protected string $alpha2,
protected string $alpha3,
protected string $name,
protected string $numeric,
protected string $flag,
protected ?string $officialName
) {}
public function getName(): string
{
return $this->name;
}
public function getLocalizedNameLabel(): string
{
return 'LLL:' . self::LABEL_FILE . ':' . $this->alpha2 . '.name';
}
public function getOfficialName(): ?string
{
return $this->officialName;
}
public function getLocalizedOfficialNameLabel(): string
{
return 'LLL:' . self::LABEL_FILE . ':' . $this->alpha2 . '.official_name';
}
public function getAlpha2IsoCode(): string
{
return $this->alpha2;
}
public function getAlpha3IsoCode(): string
{
return $this->alpha3;
}
public function getNumericRepresentation(): string
{
return $this->numeric;
}
public function getFlag(): string
{
return $this->flag;
}
public function __toString(): string
{
// This helper method allows to easily use the Object in Fluid or Extbase
// context and pass along to `<f:translate>` / `LocalizationUtility::translate()`
return $this->getLocalizedNameLabel();
}
}
+66
View File
@@ -0,0 +1,66 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Core\Country;
/**
* Filter object to limit countries to a subset of all countries.
*/
final class CountryFilter
{
/**
* @param string[] $excludeCountries
* @param string[] $onlyCountries
*/
public function __construct(private array $excludeCountries = [], private array $onlyCountries = []) {}
/**
* @return string[]
*/
public function getExcludeCountries(): array
{
return array_map(strtoupper(...), $this->excludeCountries);
}
/**
* @param string[] $excludeCountries
* @return $this
*/
public function setExcludeCountries(array $excludeCountries): CountryFilter
{
$this->excludeCountries = $excludeCountries;
return $this;
}
/**
* @return string[]
*/
public function getOnlyCountries(): array
{
return array_map(strtoupper(...), $this->onlyCountries);
}
/**
* @param string[] $onlyCountries
* @return $this
*/
public function setOnlyCountries(array $onlyCountries): CountryFilter
{
$this->onlyCountries = $onlyCountries;
return $this;
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,44 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Core\Country\Event;
use TYPO3\CMS\Core\Country\Country;
/**
* Event dispatched before countries are evaluated by CountryProvider.
*/
final class BeforeCountriesEvaluatedEvent
{
public function __construct(private array $countries) {}
/**
* @return Country[]
*/
public function getCountries(): array
{
return $this->countries;
}
/**
* @param Country[] $countries
*/
public function setCountries(array $countries): void
{
$this->countries = $countries;
}
}