shooglypeg / teams
There is no license information available for the latest version (v0.14) of this package.
team names and data
v0.14
2022-10-14 22:20 UTC
Requires
- php: ^8.0
- shooglypeg/valueobjects: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.9
- league/flysystem: ^3.2
- league/flysystem-memory: ^3.1
- nette/php-generator: ^4.0
- phpunit/phpunit: ^9.5
This package is not auto-updated.
Last update: 2024-10-26 08:17:57 UTC
README
Class to model team names with code generation from a csv of
- canonical name
- optional short name
- list of potential typos and different spellings
- is this team non-league?
// these three are equivalent $name = new TeamName('Airdrieonians'); // Canonical name $short = new TeamName('Airdrie'); // Short name $typo = new TeamName('Airdrie United'); // Out of date might get from an external source $name->short(); // return Airdrie $name = TeamName::random(); // a random team $league = TeamName::league(); // an array of all current league teams $all = TeamName::all(); // an array of all current league teams plus any non-league teams recently in the league
Extends Name
so can also...
$name = new TeamName(TeamName::HEART_OF_MIDLOTHIAN); $name->slug(); // heart--of--midlothian $name = new TeamName(TeamName::QUEENS_PARK); $name->slug(); // queen-s--park $name = TeamName::fromSlug('raith--rovers');
Class is generated from a csv like the following.
"Aberdeen",
"Airdrieonians","Airdrie","Airdrie United"
"Albion Rovers","Albion"
"Alloa Athletic","Alloa"
"Annan Athletic","Annan
"Arbroath"
"Ayr United","Ayr","Ayr Utd"
"Bonnyrigg Rose Athletic","Bonnyrigg"
"Berwick Rangers","Berwick","NONLEAGUE"