| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | 21 | public function __construct($legislatureData, $country) |
|
| 21 | { |
||
| 22 | $propertyMappings = [ |
||
| 23 | 21 | 'name' => 'name', |
|
| 24 | 14 | 'slug' => 'slug', |
|
| 25 | 14 | 'person_count' => 'personCount', |
|
| 26 | 14 | 'sha' => 'sha', |
|
| 27 | 14 | 'statement_count' => 'statementCount', |
|
| 28 | 'popolo_url' => 'popoloUrl' |
||
| 29 | 14 | ]; |
|
| 30 | 21 | foreach ($propertyMappings as $k => $v) { |
|
| 31 | 21 | $this->$v = array_key_exists($k, $legislatureData) ? $legislatureData[$k] : null; |
|
| 32 | 14 | } |
|
| 33 | 21 | $timestamp = $legislatureData['lastmod']; |
|
| 34 | 21 | $this->lastmod = DateTime::createFromFormat('U', $timestamp); |
|
| 35 | 21 | $this->legislatureData = $legislatureData; |
|
| 36 | 21 | $this->country = $country; |
|
| 37 | 21 | } |
|
| 38 | |||
| 59 |