Completed
Push — master ( cf8446...cb15b8 )
by greg
03:03 queued 10s
created

Lottery   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 3
dl 0
loc 52
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A subscribeToLottery() 0 12 1
A getGameEntity() 0 4 1
A getLotteryMapper() 0 8 2
A setLotteryMapper() 0 6 1
1
<?php
2
3
namespace PlaygroundGame\Service;
4
5
use PlaygroundGame\Mapper\GameInterface as GameMapperInterface;
6
7
class Lottery extends Game
8
{
9
    /**
10
     * @var LotteryMapperInterface
11
     */
12
    protected $lotteryMapper;
13
14
    public function subscribeToLottery($game, $user, $entry)
15
    {
16
        $entry->setDrawable(true);
17
        $entry->setActive(false);
18
        $this->getEntryMapper()->update($entry);
19
20
        $this->getEventManager()->trigger(
21
            __FUNCTION__ . '.post',
22
            $this,
23
            array('user' => $user, 'game' => $game, 'entry' => $entry)
24
        );
25
    }
26
27
    public function getGameEntity()
28
    {
29
        return new \PlaygroundGame\Entity\Lottery;
30
    }
31
32
    /**
33
     * getLotteryMapper
34
     *
35
     * @return LotteryMapperInterface
36
     */
37
    public function getLotteryMapper()
38
    {
39
        if (null === $this->lotteryMapper) {
40
            $this->lotteryMapper = $this->serviceLocator->get('playgroundgame_lottery_mapper');
41
        }
42
43
        return $this->lotteryMapper;
44
    }
45
46
    /**
47
     * setLotteryMapper
48
     *
49
     * @param  LotteryMapperInterface $lotteryMapper
50
     * @return Lottery
51
     */
52
    public function setLotteryMapper(GameMapperInterface $lotteryMapper)
53
    {
54
        $this->lotteryMapper = $lotteryMapper;
0 ignored issues
show
Documentation Bug introduced by
It seems like $lotteryMapper of type object<PlaygroundGame\Mapper\GameInterface> is incompatible with the declared type object<PlaygroundGame\Se...LotteryMapperInterface> of property $lotteryMapper.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
55
56
        return $this;
57
    }
58
}
59