ResultEntity::setResult()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
/**
4
 * Created by PhpStorm.
5
 * User: benedikt
6
 * Date: 12/16/17
7
 * Time: 1:04 PM
8
 */
9
10
namespace Tfboe\FmLib\Entity\Helpers;
11
12
13
use Tfboe\FmLib\Exceptions\ValueNotValid;
14
15
/**
16
 * Trait ResultEntity
17
 * @package Tfboe\FmLib\Entity\Helpers
18
 */
19
trait ResultEntity
20
{
21
//<editor-fold desc="Fields">
22
  /**
23
   * @ORM\Column(type="integer")
24
   * @var int
25
   */
26
  private $resultA;
27
28
  /**
29
   * @ORM\Column(type="integer")
30
   * @var int
31
   */
32
  private $resultB;
33
34
  /**
35
   * @ORM\Column(type="integer")
36
   * @var int
37
   */
38
  private $result;
39
40
  /**
41
   * @ORM\Column(type="boolean")
42
   * @var bool
43
   */
44
  private $played;
45
//</editor-fold desc="Fields">
46
47
//<editor-fold desc="Public Methods">
48
  /**
49
   * @return int
50
   */
51
  public function getResult(): int
52
  {
53
    return $this->result;
54
  }
55
56
  /**
57
   * @return int
58
   */
59
  public function getResultA(): int
60
  {
61
    return $this->resultA;
62
  }
63
64
  /**
65
   * @return int
66
   */
67
  public function getResultB(): int
68
  {
69
    return $this->resultB;
70
  }
71
72
  /**
73
   * @return bool
74
   */
75
  public function isPlayed(): bool
76
  {
77
    return $this->played;
78
  }
79
80
  /**
81
   * @param bool $played
82
   * @return $this|ResultEntity
0 ignored issues
show
Comprehensibility Bug introduced by
The return type ResultEntity is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
83
   */
84
  public function setPlayed(bool $played)
85
  {
86
    $this->played = $played;
87
    return $this;
88
  }
89
90
  /**
91
   * @param int $result
92
   * @return $this|ResultEntity
0 ignored issues
show
Comprehensibility Bug introduced by
The return type ResultEntity is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
93
   * @throws ValueNotValid
94
   */
95
  public function setResult(int $result)
96
  {
97
    Result::ensureValidValue($result);
98
    $this->result = $result;
99
    return $this;
100
  }
101
102
  /**
103
   * @param int $resultA
104
   * @return $this|ResultEntity
0 ignored issues
show
Comprehensibility Bug introduced by
The return type ResultEntity is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
105
   */
106
  public function setResultA(int $resultA)
107
  {
108
    $this->resultA = $resultA;
109
    return $this;
110
  }
111
112
  /**
113
   * @param int $resultB
114
   * @return $this|ResultEntity
0 ignored issues
show
Comprehensibility Bug introduced by
The return type ResultEntity is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
115
   */
116
  public function setResultB(int $resultB)
117
  {
118
    $this->resultB = $resultB;
119
    return $this;
120
  }
121
//</editor-fold desc="Public Methods">
122
}