1 | <?php |
||
29 | class ProfileService extends AbstractSearchService |
||
30 | { |
||
31 | /** |
||
32 | * @var RaListingRepository |
||
33 | */ |
||
34 | private $raListingRepository; |
||
35 | |||
36 | /** |
||
37 | * @var IdentityService |
||
38 | */ |
||
39 | private $identityService; |
||
40 | |||
41 | /** |
||
42 | * @var InstitutionListingRepository |
||
43 | */ |
||
44 | private $institutionListingRepository; |
||
45 | /** |
||
46 | * @var InstitutionAuthorizationService |
||
47 | */ |
||
48 | private $authorizationService; |
||
49 | |||
50 | public function __construct( |
||
61 | |||
62 | /** |
||
63 | * Uses the identityId to first load the ra credentials (if present) |
||
64 | * These credentials are then used to test what type of administrator we are dealing with ((S)RA(A)). Next the |
||
65 | * authorizations are retrieved from the InstitutionAuthorizationRepository. Finally identity is retrieved for the |
||
66 | * provided identityId. This data is then merged in a Profile value object. |
||
67 | * |
||
68 | * When the profile is incorrect, for example because no identity can be found, null is returned instead of a |
||
69 | * Profile. Its possible to retrieve profile data for a non RA user, in that case no authorization data is set |
||
70 | * on the profile. The same goes for the SRAA user. As that user is allowed all authorizations for all institutions. |
||
71 | * An additional isSraa flag is set to true for these administrators. |
||
72 | * |
||
73 | * @param string $identityId |
||
74 | * @return Profile|null |
||
75 | */ |
||
76 | public function createProfile($identityId) |
||
100 | } |
||
101 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: