OrganizingMode   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 getOrganizingMode() 0 4 1
A setOrganizingMode() 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
13
use Tfboe\FmLib\Exceptions\ValueNotValid;
14
15
/**
16
 * Trait OrganizingMode
17
 * @package Tfboe\FmLib\Entity\CategoryTraits
18
 */
19
trait OrganizingMode
20
{
21
//<editor-fold desc="Fields">
22
  /**
23
   * @ORM\Column(type="smallint", nullable=true)
24
   * @var int|null
25
   */
26
  private $organizingMode;
27
//</editor-fold desc="Fields">
28
29
//<editor-fold desc="Public Methods">
30
  /**
31
   * @return int|null
32
   */
33
  public function getOrganizingMode(): ?int
34
  {
35
    return $this->organizingMode;
36
  }
37
38
  /**
39
   * @param int|null $organizingMode
40
   * @return $this|OrganizingMode
0 ignored issues
show
Comprehensibility Bug introduced by
The return type OrganizingMode 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...
41
   * @throws ValueNotValid
42
   */
43
  public function setOrganizingMode(?int $organizingMode)
44
  {
45
    if ($organizingMode !== null) {
46
      \Tfboe\FmLib\Entity\Categories\OrganizingMode::ensureValidValue($organizingMode);
47
    }
48
    $this->organizingMode = $organizingMode;
49
    return $this;
50
  }
51
//</editor-fold desc="Public Methods">
52
}