File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 1010
1111namespace MichaelRubel \ValueObjects \Collection \Complex ;
1212
13- use Illuminate \Support \Collection ;
1413use Illuminate \Support \Facades \Validator ;
1514use Illuminate \Support \Stringable ;
1615use Illuminate \Validation \ValidationException ;
3332class Email extends Text
3433{
3534 /**
36- * @var Collection <int, string>
35+ * @var array <int, string>
3736 */
38- protected Collection $ split ;
37+ protected array $ split ;
3938
4039 /**
4140 * Create a new instance of the value object.
@@ -54,15 +53,15 @@ public function __construct(string|Stringable $value)
5453 */
5554 public function username (): string
5655 {
57- return $ this ->split -> first () ;
56+ return $ this ->split [ 0 ] ;
5857 }
5958
6059 /**
6160 * @return string
6261 */
6362 public function domain (): string
6463 {
65- return $ this ->split -> last () ;
64+ return $ this ->split [ 1 ] ;
6665 }
6766
6867 /**
@@ -113,6 +112,6 @@ protected function validationRules(): array
113112 */
114113 protected function split (): void
115114 {
116- $ this ->split = str ( $ this ->value ())-> split ( ' /@/ ' );
115+ $ this ->split = explode ( ' @ ' , $ this ->value ());
117116 }
118117}
You can’t perform that action at this time.
0 commit comments