Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
50.00% covered (danger)
50.00%
4 / 8
75.00% covered (warning)
75.00%
3 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
PersonSession
50.00% covered (danger)
50.00%
4 / 8
75.00% covered (warning)
75.00%
3 / 4
6.00
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getLoginSession
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getPerson
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 withNewToken
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/** @noinspection PhpUnhandledExceptionInspection */
3declare(strict_types=1);
4
5class PersonSession extends DataCollectionTypeSafe {
6
7
8    protected LoginSession $loginSession;
9    protected Person $person;
10
11    public function __construct(LoginSession $loginSession, Person $person) {
12
13        $this->loginSession = $loginSession;
14        $this->person = $person;
15    }
16
17
18    public function getLoginSession(): LoginSession {
19
20        return $this->loginSession;
21    }
22
23
24    public function getPerson(): Person {
25
26        return $this->person;
27    }
28
29
30    public function withNewToken(string $token): PersonSession {
31
32       return new PersonSession(
33           $this->loginSession,
34           $this->person->withNewToken($token)
35       );
36    }
37}