Completed
Push — feature/ra-location-projection... ( 904ccf...4cd14e )
by A.
04:43 queued 11s
created

RaLocationProjector   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 5
dl 0
loc 21
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A applyRaLocationAddedEvent() 0 11 1
1
<?php
2
3
/**
4
 * Copyright 2016 SURFnet B.V.
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
namespace Surfnet\StepupMiddleware\ApiBundle\Configuration\Projector;
20
21
use Broadway\ReadModel\Projector;
22
use Surfnet\Stepup\Configuration\Event\RaLocationAddedEvent;
23
use Surfnet\StepupMiddleware\ApiBundle\Configuration\Entity\RaLocation;
24
use Surfnet\StepupMiddleware\ApiBundle\Configuration\Repository\RaLocationRepository;
25
26
class RaLocationProjector extends Projector
27
{
28
    private $repository;
29
30
    public function __construct(RaLocationRepository $repository)
31
    {
32
        $this->repository = $repository;
33
    }
34
35
    public function applyRaLocationAddedEvent(RaLocationAddedEvent $event)
36
    {
37
        $raLocation = new RaLocation(
38
            $event->raLocationId->getRaLocationId(),
0 ignored issues
show
Unused Code introduced by
The call to RaLocation::__construct() has too many arguments starting with $event->raLocationId->getRaLocationId().

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
39
            $event->raLocationName,
40
            $event->location,
41
            $event->contactInformation
42
        );
43
44
        $this->repository->save($raLocation);
45
    }
46
}
47