code2flourish / senregions
获取所有塞内加尔地区和部门
1.1.0
2021-02-15 19:23 UTC
Requires
- ext-json: *
Requires (Dev)
- phpunit/phpunit: ^9.5
README
塞内加尔地区和部门
如果您想要拥有塞内加尔的所有地区和部门,请使用此包
安装
使用composer安装此包
composer require code2flourish/senregions
使用方法
获取所有地区
use Code2Flourish\SenRegions\RegionFactory; use Code2Flourish\SenRegions\Adapters\FileGetContentsWrapper; $fileSystem = new FileGetContentsWrapper(); $factory = new RegionFactory($fileSystem); $regions = $factory->getAll();
获取随机地区
use Code2Flourish\SenRegions\RegionFactory; use Code2Flourish\SenRegions\Adapters\FileGetContentsWrapper; $fileSystem = new FileGetContentsWrapper(); $factory = new RegionFactory($fileSystem); $region = $factory->getRandomRegion();
获取所有部门
use Code2Flourish\SenRegions\DepartmentFactory; use Code2Flourish\SenRegions\Adapters\FileGetContentsWrapper; $fileSystem = new FileGetContentsWrapper(); $factory = new DepartmentFactory($fileSystem); $departments = $factory->getAll();
获取一个地区的所有部门
use Code2Flourish\SenRegions\DepartmentFactory; use Code2Flourish\SenRegions\Adapters\FileGetContentsWrapper; $fileSystem = new FileGetContentsWrapper(); $factory = new DepartmentFactory($fileSystem); $departments = $factory->getAllByRegion(1);
✍🏾: 参数中传入的数字代表地区ID,您可以在地区列表中找到该ID
获取随机部门
use Code2Flourish\SenRegions\DepartmentFactory; use Code2Flourish\SenRegions\Adapters\FileGetContentsWrapper; $fileSystem = new FileGetContentsWrapper(); $factory = new DepartmentFactory($fileSystem); $department = $factory->getRandomDepartment();
贡献
欢迎提交pull请求。对于重大更改,请先打开一个issue进行讨论,您希望进行哪些更改。
请确保根据需要更新测试。