Competitor::getAwardDollar()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * @property integer $uid
4
 * @property integer $skill
5
 * @property integer $chance
6
 * @property integer $energy
7
 * @property integer $avgEnergy
8
 * @property integer $dollar
9
 * @property string $club
10
 * @property boolean $isCaller
11
 * @property boolean $winner
12
 * @property integer $opponent
13
 * @property integer $reqEnergy
14
 * @property integer $reqDollar
15
 * @property integer $awardXp
16
 * @property integer $awardDollar
17
 * @property integer $awardPoints
18
 * @property integer $duelId
19
 */
20
class Competitor extends CModel
21
{
22
    protected $uid;
23
    protected $skill;
24
    protected $chance;
25
    protected $energy;
26
    protected $avgEnergy;
27
    protected $dollar;
28
    protected $club;
29
30
    protected $isCaller = false;
31
    protected $winner = false;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
32
33
    protected $duelId;
34
    protected $opponent;
35
36
    //reqs, awards
37
    protected $reqEnergy = 0;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
38
    protected $reqDollar = 0;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
39
    protected $awardXp = 0;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
40
    protected $awardDollar = 0;
41
    protected $awardPoints = 0;
42
43
    protected $mapReqs = ['energy'=>'reqEnergy', 'dollar'=>'reqDollar'];
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
44
    protected $mapAwards = ['xp_all'=>'awardXp', 'xp_delta'=>'awardXp', 'dollar'=>'awardDollar', 'duel_points'=>'awardPoints'];
45
46
    public function attributeNames()
47
    {
48
        return [];
49
    }
50
51
    public function getUid()
52
    {
53
        return $this->uid;
54
    }
55
56
    public function getSkill()
57
    {
58
        return $this->skill;
59
    }
60
61
    public function getChance()
62
    {
63
        return $this->chance;
64
    }
65
66
    public function getEnergy()
67
    {
68
        return $this->energy;
69
    }
70
71
    public function getDollar()
72
    {
73
        return $this->dollar;
74
    }
75
    public function getIsCaller()
76
    {
77
        return $this->isCaller;
78
    }
79
    public function getWinner()
80
    {
81
        return $this->winner;
82
    }
83
84
    public function getOpponent()
85
    {
86
        return $this->opponent;
87
    }
88
89
    public function getAvgEnergy()
90
    {
91
        return $this->avgEnergy;
92
    }
93
    public function getReqEnergy()
94
    {
95
        return $this->reqEnergy;
96
    }
97
    public function getReqDollar()
98
    {
99
        return $this->reqDollar;
100
    }
101
    public function getAwardXp()
102
    {
103
        return $this->awardXp;
104
    }
105
    public function getAwardDollar()
106
    {
107
        return $this->awardDollar;
108
    }
109
    public function getAwardPoints()
110
    {
111
        return $this->awardPoints;
112
    }
113
    public function getClub()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
114
    {
115
        return $this->club;
116
    }
117
118
119
    public function setUid($uid)
120
    {
121
        $this->uid = (int)$uid;
122
    }
123
124
    public function setSkill($skill)
125
    {
126
        $this->skill = (int)$skill;
127
    }
128
129
    public function setChance($chance)
130
    {
131
        $this->chance = (int)$chance;
132
    }
133
134
    public function setEnergy($energy)
135
    {
136
        $this->energy = (int)$energy;
137
    }
138
    public function setAvgEnergy($avgEnergy)
139
    {
140
        $this->avgEnergy = (int)$avgEnergy;
141
    }
142
143
    public function setDollar($dollar)
144
    {
145
        $this->dollar = (int)$dollar;
146
    }
147
    public function setIsCaller($isCaller)
148
    {
149
        $this->isCaller = (bool)$isCaller;
150
    }
151
    public function setWinner($isWinner)
152
    {
153
        $this->winner = (int)$isWinner;
0 ignored issues
show
Documentation Bug introduced by
The property $winner was declared of type boolean, but (int) $isWinner is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
154
    }
155
156
    public function setDuelId($id)
157
    {
158
        $this->duelId = (int)$id;
159
    }
160
    public function setOpponent($opponent)
161
    {
162
        $this->opponent = $opponent;
163
    }
164
    public function setClub($club)
165
    {
166
        $this->club = $club;
167
    }
168
169
    /**
170
     * @param integer $duelId
171
     */
172
    public function fetchFromLog($duelId)
173
    {
174
        $role = $this->isCaller ? 'caller' : 'opponent';
175
176
        $res = Yii::app()->db->createCommand()
177
            ->select('dp.*, m.user')
178
            ->from('duel_player dp')
179
            ->join('main m', 'dp.uid=m.uid')
180
            ->where('dp.duel_id = :id AND dp.role=:role', [':id'=>$duelId, ':role'=>$role])
181
            ->queryRow();
182
183
        $this->skill = $res['skill'];
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
184
        $this->chance = $res['chance'];
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
185
        $this->energy = $res['energy'];
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
186
        $this->dollar = $res['dollar'];
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
187
        $this->reqEnergy = $res['req_energy'];
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
188
        $this->reqDollar = $res['req_dollar'];
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
189
        $this->awardXp = $res['award_xp'];
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
190
        $this->awardDollar = $res['award_dollar'];
191
        $this->awardPoints = $res['duel_points'];
192
        $this->winner = $res['winner'];
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
193
        $this->club = $res['club'];
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
194
    }
195
    public function play($isWinner)
196
    {
197
        $this->winner = $isWinner;
198
199
        if ($this->winner) {
200
            $this->winPrize();
201
            $this->updateLeaderboard();
202
        } else {
203
            $this->losePrize();
204
        }
205
    }
206
207
    public function finish($player)
208
    {
209
        $this->updateAttributes($player);
210
211
        $contest = new Contest;
212
        $contest->addPoints($this->uid, Contest::ACT_DUEL, $this->reqEnergy, $this->awardXp, $this->awardDollar);
213
214
        $this->log();
215
        $stat = $this->incrementCounters($player);
216
        $this->addBadges($player, $stat);
217
218
        if (!$this->isCaller) {
219
            $this->sendWallMessage();
220
        }
221
    }
222
    protected function updateAttributes($player)
223
    {
224
        $player->updateAttributes(
225
            $this->membersToArray($this->mapAwards),
226
            $this->membersToArray($this->mapReqs)
227
        );
228
    }
229
230
    protected function membersToArray($map)
231
    {
232
        $result = [];
233
        foreach ($map as $sql => $member) {
234
            if ($this->$member) {
235
                $result[$sql] = $this->$member;
236
            }
237
        }
238
        return $result;
239
    }
240
241
    public function resetAwards()
242
    {
243
        $this->reqEnergy = 0;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
244
        $this->reqDollar = 0;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
245
        $this->awardXp = 0;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
246
        $this->awardDollar = 0;
247
        $this->awardPoints = 0;
248
    }
249
250
    protected function winPrize()
251
    {
252
        $this->reqEnergy = $this->energy;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
253
        $this->awardXp = round($this->avgEnergy * ($this->opponent['chance'] / 100));
0 ignored issues
show
Documentation Bug introduced by
The property $awardXp was declared of type integer, but round($this->avgEnergy *...onent['chance'] / 100)) is of type double. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
254
        $this->awardDollar = round($this->opponent['dollar'] * ($this->opponent['chance'] / 100));
0 ignored issues
show
Documentation Bug introduced by
The property $awardDollar was declared of type integer, but round($this->opponent['d...onent['chance'] / 100)) is of type double. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
255
        $this->awardPoints = round($this->avgEnergy * ($this->compensator($this->opponent['chance']) / 100));
0 ignored issues
show
Documentation Bug introduced by
The property $awardPoints was declared of type integer, but round($this->avgEnergy *...nent['chance']) / 100)) is of type double. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
256
    }
257
258
    protected function losePrize()
259
    {
260
        $this->reqEnergy = $this->energy;
261
        $this->reqDollar = round($this->dollar * $this->chance / 100);
0 ignored issues
show
Documentation Bug introduced by
The property $reqDollar was declared of type integer, but round($this->dollar * $this->chance / 100) is of type double. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
262
        $this->awardXp = round($this->avgEnergy * ($this->chance / 100) / 5); //20% of winners prize
0 ignored issues
show
Documentation Bug introduced by
The property $awardXp was declared of type integer, but round($this->avgEnergy *...his->chance / 100) / 5) is of type double. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
263
    }
264
265
    public function compensator($value)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
266
    {
267
        $min = Yii::app()->params['competitorCompensatorMin'];
268
        $max = Yii::app()->params['competitorCompensatorMax'];
269
270
        if ($value < $min) {
271
            $value = $min;
272
        }
273
274
        if ($value > $max) {
275
            $value = $max;
276
        }
277
278
        return $value;
279
    }
280
281
    protected function updateLeaderboard()
282
    {
283
        if (!$this->awardPoints) {
284
            return false;
285
        }
286
287
        Yii::app()->redis->getClient()->zIncrBy('board_p:'.date('Ym'), $this->awardPoints, $this->uid);
288
        return true;
289
    }
290
291
    protected function log()
292
    {
293
        $role = $this->isCaller ? 'caller' : 'opponent';
294
295
        $parameters = [
296
            'duel_id'=>$this->duelId,
297
            'role'=>$role,
298
            'uid'=>$this->uid,
299
            'skill'=>$this->skill,
300
            'chance'=>$this->chance,
301
            'energy'=>$this->energy,
302
            'dollar'=>$this->dollar,
303
            'req_energy'=>$this->reqEnergy,
304
            'req_dollar'=>$this->reqDollar,
305
            'award_xp'=>$this->awardXp,
306
            'award_dollar'=>$this->awardDollar,
307
            'duel_points'=>$this->awardPoints,
308
            'winner'=>(int)$this->winner,
309
            'club'=>$this->club
310
            ];
311
312
        Yii::app()->db->createCommand()->insert('duel_player', $parameters);
313
    }
314
315
    protected function incrementCounters($player)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
316
    {
317
        //log mission counter
318
        $cell = 'duel_' . ($this->winner ? 'success' : 'fail');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
319
        $logger = new Logger;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
320
        $logger->uid = $this->uid;
0 ignored issues
show
Bug introduced by
The property uid cannot be accessed from this context as it is declared private in class Logger.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
321
        $logger->level = $player->level;
0 ignored issues
show
Bug introduced by
The property level cannot be accessed from this context as it is declared private in class Logger.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
322
        $logger->increment($cell, 1);
323
        return $logger->getCounters();
324
    }
325
326
    protected function addBadges($player, $stat)
327
    {
328
        $role = $this->isCaller ? 'caller' : 'opponent';
329
330
        $b = new DuelBadgeActivator();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
331
        $b->uid = $this->uid;
332
333
        $b->triggerDuelFirstWin($this->winner, $role);
334
        $b->triggerDuelSuccess((int)@$stat['duel_success']);
335
        $b->triggerDuelFail((int)@$stat['duel_fail']);
336
        $b->triggerDuelRate((int)@$stat['duel_success'], (int)@$stat['duel_fail']);
337
        $b->triggerDuelMoney($this->awardDollar);
338
        $b->triggerDuelWinChance($this->winner, $this->chance);
339
        $b->triggerDuelLoseChance($this->winner, $this->chance);
340
        $b->triggerDuel2h($role);
341
342
        $b->uid = $player->uid; //reset uid
343
    }
344
345
    protected function sendWallMessage()
346
    {
347
        $wall = new Wall;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 15 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
348
        $wall->content_type = Wall::TYPE_DUEL;
0 ignored issues
show
Bug introduced by
The property content_type cannot be accessed from this context as it is declared private in class Wall.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
349
        $wall->uid = $this->uid;
0 ignored issues
show
Bug introduced by
The property uid cannot be accessed from this context as it is declared private in class Wall.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
350
351
        $wall->add([
352
            'duel_id'=>$this->duelId,
353
            'caller_uid'=>$this->opponent['uid'],
354
            'caller_user'=>$this->opponent['user'],
355
            'req_energy'=>$this->reqEnergy,
356
            'req_dollar'=>$this->reqDollar,
357
            'award_xp'=>$this->awardXp,
358
            'award_dollar'=>$this->awardDollar,
359
            'winner'=>$this->winner
360
            ]);
361
    }
362
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
363