Completed
Push — master ( a5446b...0a03f7 )
by greg
06:15 queued 03:04
created

TradingCard::setBoosterCardNumber()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
namespace PlaygroundGame\Entity;
3
4
use PlaygroundGame\Entity\Game;
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\Mapping as ORM;
7
use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
8
use Zend\InputFilter\InputFilter;
9
use Zend\InputFilter\Factory as InputFactory;
10
use Zend\InputFilter\InputFilterAwareInterface;
11
use Zend\InputFilter\InputFilterInterface;
12
13
/**
14
 * @ORM\Entity @HasLifecycleCallbacks
15
 * @ORM\Table(name="game_tradingcard")
16
 */
17
class TradingCard extends Game implements InputFilterAwareInterface
18
{
19
    const CLASSTYPE = 'tradingcard';
20
21
    /**
22
     * the card models associated with the game
23
     * @ORM\OneToMany(targetEntity="TradingCardModel", mappedBy="game")
24
     */
25
    protected $models;
26
27
    /**
28
     * The number of cards in a booster
29
     * @ORM\Column(name="booster_card_number", type="integer", nullable=true)
30
     */
31
    protected $boosterCardNumber;
32
33
    /**
34
     * The number of boosters to deliver to user for each entry
35
     * @ORM\Column(name="booster_draw_quantity", type="integer", nullable=true)
36
     */
37
    protected $boosterDrawQuantity;
38
    
39
    public function __construct()
40
    {
41
        parent::__construct();
42
        $this->setClassType(self::CLASSTYPE);
43
        $this->models = new ArrayCollection();
44
    }
45
46
    /**
47
     * Gets the the card models associated with the game.
48
     *
49
     * @return mixed
50
     */
51
    public function getModels()
52
    {
53
        return $this->models;
54
    }
55
56
    /**
57
     * Sets the the card models associated with the game.
58
     *
59
     * @param mixed $models the models
60
     *
61
     * @return self
62
     */
63
    protected function setModels($models)
64
    {
65
        $this->models = $models;
66
67
        return $this;
68
    }
69
70
    /**
71
     * Add a model to the trading card.
72
     *
73
     *
74
     * @return void
75
     */
76
    public function addModel($model)
77
    {
78
        $this->models[] = $model;
79
    }
80
81
    /**
82
     * Gets the The number of cards in a booster.
83
     *
84
     * @return mixed
85
     */
86
    public function getBoosterCardNumber()
87
    {
88
        return $this->boosterCardNumber;
89
    }
90
91
    /**
92
     * Sets the The number of cards in a booster.
93
     *
94
     * @param mixed $boosterCardNumber the booster card number
95
     *
96
     * @return self
97
     */
98
    public function setBoosterCardNumber($boosterCardNumber)
99
    {
100
        $this->boosterCardNumber = $boosterCardNumber;
101
102
        return $this;
103
    }
104
105
    /**
106
     * Gets the The number of boosters to deliver to user.
107
     *
108
     * @return mixed
109
     */
110
    public function getBoosterDrawQuantity()
111
    {
112
        return $this->boosterDrawQuantity;
113
    }
114
115
    /**
116
     * Sets the The number of boosters to deliver to user.
117
     *
118
     * @param mixed $boosterDrawQuantity the booster draw quantity
119
     *
120
     * @return self
121
     */
122
    public function setBoosterDrawQuantity($boosterDrawQuantity)
123
    {
124
        $this->boosterDrawQuantity = $boosterDrawQuantity;
125
126
        return $this;
127
    }
128
129
    /**
130
     * Convert the object to an array.
131
     *
132
     * @return array
133
     */
134
    public function getArrayCopy()
135
    {
136
        $obj_vars = parent::getArrayCopy();
137
        array_merge($obj_vars, get_object_vars($this));
138
139
        return $obj_vars;
140
    }
141
142
    public function setInputFilter(InputFilterInterface $inputFilter)
143
    {
144
        throw new \Exception("Not used");
145
    }
146
147 View Code Duplication
    public function getInputFilter()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
148
    {
149
        if (!$this->inputFilter) {
150
            $inputFilter = new InputFilter();
0 ignored issues
show
Unused Code introduced by
$inputFilter is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
151
            $factory = new InputFactory();
0 ignored issues
show
Unused Code introduced by
$factory is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
152
153
            $inputFilter = parent::getInputFilter();
154
155
            $this->inputFilter = $inputFilter;
156
        }
157
158
        return $this->inputFilter;
159
    }
160
}
161