Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
28 | 18 | public static function fromNative($nativeValue): self |
|
29 | { |
||
30 | 18 | Assertion::nullOrString($nativeValue); |
|
31 | 18 | if (empty($nativeValue)) { |
|
32 | 1 | return new self(Text::fromNative(self::NIL), Text::fromNative(self::NIL)); |
|
33 | } |
||
34 | 18 | Assertion::email($nativeValue, "Trying to create email from invalid string."); |
|
35 | 18 | $parts = explode("@", $nativeValue); |
|
36 | 18 | return new self(Text::fromNative($parts[0]), Text::fromNative(trim($parts[1], "[]"))); |
|
37 | } |
||
38 | |||
73 |