TeamMode   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTeamMode() 0 4 1
A setTeamMode() 0 8 2
1
<?php
2
declare(strict_types=1);
3
/**
4
 * Created by PhpStorm.
5
 * User: benedikt
6
 * Date: 9/22/17
7
 * Time: 5:38 PM
8
 */
9
10
namespace Tfboe\FmLib\Entity\CategoryTraits;
11
12
use Tfboe\FmLib\Exceptions\ValueNotValid;
13
14
/**
15
 * Trait TeamMode
16
 * @package Tfboe\FmLib\Entity\CategoryTraits
17
 */
18
trait TeamMode
19
{
20
//<editor-fold desc="Fields">
21
  /**
22
   * @ORM\Column(type="smallint", nullable=true)
23
   * @var int|null
24
   */
25
  private $teamMode;
26
//</editor-fold desc="Fields">
27
28
//<editor-fold desc="Public Methods">
29
  /**
30
   * @return int|null
31
   */
32
  public function getTeamMode(): ?int
33
  {
34
    return $this->teamMode;
35
  }
36
37
  /**
38
   * @param int|null $teamMode
39
   * @return $this|TeamMode
0 ignored issues
show
Comprehensibility Bug introduced by
The return type TeamMode 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...
40
   * @throws ValueNotValid
41
   */
42
  public function setTeamMode(?int $teamMode)
43
  {
44
    if ($teamMode !== null) {
45
      \Tfboe\FmLib\Entity\Categories\TeamMode::ensureValidValue($teamMode);
46
    }
47
    $this->teamMode = $teamMode;
48
    return $this;
49
  }
50
//</editor-fold desc="Public Methods">
51
}