-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
228 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ vendor/ | |
build/ | ||
yarn.lock | ||
node_modules/ | ||
pull_request.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version":1,"defects":{"DistrictTest::testDistrictsDoesNotExist":4,"VillageTest::testVillageInNonExistentParish":4},"times":{"CountyTest::testUgandaHasCounties":0.037,"DistrictTest::testUgandaHasDistricts":0.046,"DistrictTest::testDistrictsDoesNotExist":0.065,"DistrictTest::testDistrictHasCounties":0.084,"DistrictTest::testDistrictHasSubCounties":0.185,"ParishTest::testUgandaHasParishes":0.133,"ParishTest::testParishInNonExistentSubCounty":0.184,"ParishTest::testDistrictHasParishes":0.469,"SubCountyTest::testUgandaHasSubCounties":0.054,"SubCountyTest::testSubCountiesInNonExistentCounty":0.058,"SubCountyTest::testDistrictHasSubCounties":0.113,"VillageTest::testUgandaHasVillages":0.603,"VillageTest::testVillageInNonExistentParish":0.965,"VillageTest::testDistrictHasVillages":4.698}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace Uganda\Util; | ||
|
||
trait County { | ||
use Helpers; | ||
public function counties($county = null) { | ||
$counties = $this->fetch('counties.json'); | ||
if ($county) { | ||
$filtered = array_filter($counties, $this->filter('name', $county)); | ||
if (empty($filtered)) { | ||
$this->_error['county'] = 'County ' . $county . ' does not exist.'; | ||
} else { | ||
$this->_county = [...$filtered][0]['id']; | ||
} | ||
} else { | ||
if (isset($this->_district)) { | ||
$filtered = array_filter($counties, $this->filter('district', $this->_district)); | ||
$this->_counties['counties'] = $this->format([...$filtered]); | ||
} else { | ||
$this->_counties['counties'] = $this->format($counties); | ||
} | ||
} | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Uganda\Util; | ||
|
||
trait District { | ||
use Helpers; | ||
public function districts($district = null) { | ||
$districts = $this->fetch('districts.json'); | ||
|
||
if ($district) { | ||
$filtered = array_filter($districts, $this->filter('name', $district)); | ||
|
||
if (empty($filtered)) { | ||
$this->_error['district'] = 'District ' . $district . ' does not exist.'; | ||
} else { | ||
$this->_district = [...$filtered][0]['id']; | ||
} | ||
} else { | ||
$this->_districts['districts'] = $this->format($districts); | ||
} | ||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Uganda\Util; | ||
|
||
trait Parish { | ||
use Helpers; | ||
public function parishes($parish = null) { | ||
$parishes = $this->fetch('parishes.json'); | ||
if ($parish) { | ||
$filtered = array_filter($parishes, $this->filter('name', $parish)); | ||
if (empty($filtered)) { | ||
$this->_error['parish'] = 'Parish ' . $parish . ' does not exist.'; | ||
} else { | ||
$this->_parish = [...$filtered][0]['id']; | ||
} | ||
} else { | ||
if (isset($this->_district) && isset($this->_county) && isset($this->_sub_county)) { | ||
|
||
$filtered = array_filter($parishes, $this->filter('subcounty', $this->_sub_county)); | ||
$this->_parishes['parishes'] = $this->format([...$filtered]); | ||
} else { | ||
$this->_parishes['parishes'] = $this->format($parishes); | ||
} | ||
} | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace Uganda\Util; | ||
|
||
trait SubCounty { | ||
use Helpers; | ||
public function sub_counties($sub_county = null) { | ||
$sub_counties = $this->fetch('sub_counties.json'); | ||
if ($sub_county) { | ||
$filtered = array_filter($sub_counties, $this->filter('name', $sub_county)); | ||
if (empty($filtered)) { | ||
$this->_error['sub_county'] = 'Sub county ' . $sub_county . ' does not exist.'; | ||
} else { | ||
$this->_sub_county = [...$filtered][0]['id']; | ||
} | ||
} else { | ||
if (isset($this->_district) && isset($this->_county)) { | ||
$filtered = array_filter($sub_counties, $this->filter('county', $this->_county)); | ||
$this->_sub_counties['sub_counties'] = $this->format([...$filtered]); | ||
} else { | ||
$this->_sub_counties['sub_counties'] = $this->format($sub_counties); | ||
} | ||
} | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Uganda\Util; | ||
|
||
trait Village { | ||
use Helpers; | ||
public function villages() { | ||
$villages = $this->fetch('villages.json'); | ||
|
||
if (isset($this->_district) && isset($this->_county) && isset($this->_sub_county) && isset($this->_parish)) { | ||
$filtered = array_filter($villages, $this->filter('parish', $this->_parish)); | ||
$this->_villages['villages'] = $this->format([...$filtered]); | ||
} else { | ||
$this->_villages['villages'] = $this->format($villages); | ||
} | ||
|
||
return $this; | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.