• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PHP-Alchemist / coreFiles / 15336161504

30 May 2025 12:11AM UTC coverage: 91.167% (-5.3%) from 96.503%
15336161504

Pull #8

github

web-flow
Merge d743e777d into 9b35abb30
Pull Request #8: [feature] valueObjects

34 of 71 new or added lines in 7 files covered. (47.89%)

578 of 634 relevant lines covered (91.17%)

4.5 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

30.77
/src/ValueObject/Model/Email.php
1
<?php
2

3
namespace PHPAlchemist\ValueObject\Model;
4

5
use InvalidArgumentException;
6
use PHPAlchemist\Types\Twine;
7
use PHPAlchemist\ValueObject\Abstract\AbstractString;
8

9
final class Email extends AbstractString
10
{
11
    public function __construct(string $value)
4✔
12
    {
13
        if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
4✔
14
            throw new InvalidArgumentException('Invalid email address.');
1✔
15
        }
16

17
        $this->value = $value;
3✔
18
    }
19

NEW
20
    public function getUser() : Twine
×
21
    {
NEW
22
        $parts = explode('@', $this->value, 2);
×
23

NEW
24
        return new Twine(array_shift($parts));
×
25
    }
26

NEW
27
    public function getDomain() : Twine
×
28
    {
NEW
29
        $parts = explode('@', $this->value, 2);
×
30

NEW
31
        return new Twine(array_pop($parts));
×
32
    }
33

NEW
34
    public function getTLD() : Twine
×
35
    {
NEW
36
        $parts = explode('.', $this->value);
×
37

NEW
38
        return new Twine(array_pop($parts));
×
39
    }
40
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc