Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
81.82% |
18 / 22 |
|
42.86% |
3 / 7 |
|
42.86% |
3 / 7 |
|
42.86% |
3 / 7 |
CRAP | |
0.00% |
0 / 1 |
| DoctrineIdentity | |
81.82% |
18 / 22 |
|
42.86% |
3 / 7 |
|
42.86% |
3 / 7 |
|
42.86% |
3 / 7 |
16.14 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getEmail | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getRoles | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getPasswordHash | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| fromDomain | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toDomain | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Auth\Infrastructure\Persistence\Doctrine\Entity; |
| 4 | |
| 5 | use App\Auth\Domain\Model\Identity; |
| 6 | use App\Shared\Domain\Model\EntityId; |
| 7 | use Doctrine\ORM\Mapping as ORM; |
| 8 | |
| 9 | #[ORM\Entity] |
| 10 | #[ORM\Table(name: "identities")] |
| 11 | class DoctrineIdentity |
| 12 | { |
| 13 | #[ORM\Id, ORM\Column(type: "string", length: 36)] |
| 14 | private string $id; |
| 15 | |
| 16 | #[ORM\Column(type: "string", length: 180, unique: true)] |
| 17 | private string $email; |
| 18 | |
| 19 | #[ORM\Column(type: "string", length: 60, unique: true)] |
| 20 | private string $username; |
| 21 | |
| 22 | /** |
| 23 | * @var list<string> |
| 24 | */ |
| 25 | #[ORM\Column(type: "json")] |
| 26 | private array $roles; |
| 27 | |
| 28 | #[ORM\Column(type: "string", nullable: false)] |
| 29 | private string $passwordHash; |
| 30 | |
| 31 | #[ORM\Column(type: "boolean", nullable: false, options: ["default" => false])] |
| 32 | private bool $isComplete; |
| 33 | #[ORM\Column(type: "string", length: 36, nullable: false, options: ["default" => ""])] |
| 34 | private string $validationToken; |
| 35 | |
| 36 | /** |
| 37 | */ |
| 38 | public function __construct( |
| 39 | /*string $id, |
| 40 | string $email, |
| 41 | string $username, |
| 42 | string $passwordHash, |
| 43 | array $roles*/ |
| 44 | ) { |
| 45 | /*$this->id = $id; |
| 46 | $this->email = $email; |
| 47 | $this->username = $username; |
| 48 | $this->passwordHash = $passwordHash; |
| 49 | $this->roles = $roles;*/ |
| 50 | } |
| 51 | |
| 52 | public function getId(): string |
| 53 | { |
| 54 | return $this->id; |
| 55 | } |
| 56 | |
| 57 | public function getEmail(): string |
| 58 | { |
| 59 | return $this->email; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * @return list<string> |
| 64 | */ |
| 65 | public function getRoles(): array |
| 66 | { |
| 67 | return $this->roles; |
| 68 | } |
| 69 | |
| 70 | public function getPasswordHash(): ?string |
| 71 | { |
| 72 | return $this->passwordHash; |
| 73 | } |
| 74 | |
| 75 | public function fromDomain(Identity $identity): DoctrineIdentity |
| 76 | { |
| 77 | $this->id = $identity->getId(); |
| 78 | $this->email = $identity->getEmail(); |
| 79 | $this->username = $identity->getUsername(); |
| 80 | $this->roles = $identity->getRoles(); |
| 81 | $this->passwordHash = $identity->getPasswordHash(); |
| 82 | $this->isComplete = $identity->isComplete(); |
| 83 | $this->validationToken = $identity->getValidationToken(); |
| 84 | return $this; |
| 85 | } |
| 86 | |
| 87 | public function toDomain(): Identity |
| 88 | { |
| 89 | return new Identity( |
| 90 | id: EntityId::fromString($this->id), |
| 91 | email: $this->email, |
| 92 | username: $this->username, |
| 93 | passwordHash: $this->passwordHash, |
| 94 | roles: $this->roles, |
| 95 | isComplete: $this->isComplete, |
| 96 | validationToken: $this->validationToken |
| 97 | ); |
| 98 | } |
| 99 | } |
Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not
necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once.
Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement
always has an else as part of its logical flow even if you didn't write one.
| 50 | } |
| 75 | public function fromDomain(Identity $identity): DoctrineIdentity |
| 76 | { |
| 77 | $this->id = $identity->getId(); |
| 78 | $this->email = $identity->getEmail(); |
| 79 | $this->username = $identity->getUsername(); |
| 80 | $this->roles = $identity->getRoles(); |
| 81 | $this->passwordHash = $identity->getPasswordHash(); |
| 82 | $this->isComplete = $identity->isComplete(); |
| 83 | $this->validationToken = $identity->getValidationToken(); |
| 84 | return $this; |
| 85 | } |
| 59 | return $this->email; |
| 60 | } |
| 54 | return $this->id; |
| 55 | } |
| 72 | return $this->passwordHash; |
| 73 | } |
| 67 | return $this->roles; |
| 68 | } |
| 89 | return new Identity( |
| 90 | id: EntityId::fromString($this->id), |
| 91 | email: $this->email, |
| 92 | username: $this->username, |
| 93 | passwordHash: $this->passwordHash, |
| 94 | roles: $this->roles, |
| 95 | isComplete: $this->isComplete, |
| 96 | validationToken: $this->validationToken |
| 97 | ); |
| 98 | } |
| 3 | namespace App\Auth\Infrastructure\Persistence\Doctrine\Entity; |
| 4 | |
| 5 | use App\Auth\Domain\Model\Identity; |
| 6 | use App\Shared\Domain\Model\EntityId; |
| 7 | use Doctrine\ORM\Mapping as ORM; |
| 8 | |
| 9 | #[ORM\Entity] |
| 10 | #[ORM\Table(name: "identities")] |
| 11 | class DoctrineIdentity |
| 12 | { |
| 13 | #[ORM\Id, ORM\Column(type: "string", length: 36)] |
| 14 | private string $id; |
| 15 | |
| 16 | #[ORM\Column(type: "string", length: 180, unique: true)] |
| 17 | private string $email; |
| 18 | |
| 19 | #[ORM\Column(type: "string", length: 60, unique: true)] |
| 20 | private string $username; |
| 21 | |
| 22 | /** |
| 23 | * @var list<string> |
| 24 | */ |
| 25 | #[ORM\Column(type: "json")] |
| 26 | private array $roles; |
| 27 | |
| 28 | #[ORM\Column(type: "string", nullable: false)] |
| 29 | private string $passwordHash; |
| 30 | |
| 31 | #[ORM\Column(type: "boolean", nullable: false, options: ["default" => false])] |
| 32 | private bool $isComplete; |
| 33 | #[ORM\Column(type: "string", length: 36, nullable: false, options: ["default" => ""])] |
| 34 | private string $validationToken; |
| 35 | |
| 36 | /** |
| 37 | */ |
| 38 | public function __construct( |
| 39 | /*string $id, |
| 40 | string $email, |
| 41 | string $username, |
| 42 | string $passwordHash, |
| 43 | array $roles*/ |
| 44 | ) { |
| 45 | /*$this->id = $id; |
| 46 | $this->email = $email; |
| 47 | $this->username = $username; |
| 48 | $this->passwordHash = $passwordHash; |
| 49 | $this->roles = $roles;*/ |
| 50 | } |
| 51 | |
| 52 | public function getId(): string |
| 53 | { |
| 54 | return $this->id; |
| 55 | } |
| 56 | |
| 57 | public function getEmail(): string |
| 58 | { |
| 59 | return $this->email; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * @return list<string> |
| 64 | */ |
| 65 | public function getRoles(): array |
| 66 | { |
| 67 | return $this->roles; |
| 68 | } |
| 69 | |
| 70 | public function getPasswordHash(): ?string |
| 71 | { |
| 72 | return $this->passwordHash; |
| 73 | } |
| 74 | |
| 75 | public function fromDomain(Identity $identity): DoctrineIdentity |
| 76 | { |
| 77 | $this->id = $identity->getId(); |
| 78 | $this->email = $identity->getEmail(); |
| 79 | $this->username = $identity->getUsername(); |
| 80 | $this->roles = $identity->getRoles(); |
| 81 | $this->passwordHash = $identity->getPasswordHash(); |
| 82 | $this->isComplete = $identity->isComplete(); |
| 83 | $this->validationToken = $identity->getValidationToken(); |
| 84 | return $this; |
| 85 | } |
| 86 | |
| 87 | public function toDomain(): Identity |
| 88 | { |
| 89 | return new Identity( |
| 90 | id: EntityId::fromString($this->id), |
| 91 | email: $this->email, |
| 92 | username: $this->username, |
| 93 | passwordHash: $this->passwordHash, |
| 94 | roles: $this->roles, |
| 95 | isComplete: $this->isComplete, |
| 96 | validationToken: $this->validationToken |
| 97 | ); |
| 98 | } |