| Conditions | 4 |
| Paths | 4 |
| Total Lines | 20 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 4.0047 |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | 20 | public function __construct($value) |
|
| 14 | { |
||
| 15 | 20 | parent::__construct($value); |
|
| 16 | |||
| 17 | 20 | $parts = explode('-', $this->type); |
|
| 18 | |||
| 19 | 20 | if (2 === count($parts)) { |
|
| 20 | 4 | $this->language = $parts[0]; |
|
| 21 | 4 | $this->region = $parts[1]; |
|
| 22 | 20 | } elseif (1 === count($parts)) { |
|
| 23 | 17 | $this->language = $parts[0]; |
|
| 24 | 17 | } elseif (3 === count($parts)) { |
|
| 25 | 1 | $this->language = $parts[0]; |
|
| 26 | 1 | $this->script = $parts[1]; |
|
| 27 | 1 | $this->region = $parts[2]; |
|
| 28 | 1 | } else { |
|
| 29 | // TODO: this part is never reached... |
||
| 30 | throw new InvalidLanguage(); |
||
| 31 | } |
||
| 32 | 20 | } |
|
| 33 | |||
| 50 |