Completed
Push — master ( c087ad...47fff7 )
by Benedikt
02:33
created

QualificationSystem::setPreviousPhase()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
rs 9.4285
1
<?php
2
declare(strict_types=1);
3
/**
4
 * Created by PhpStorm.
5
 * User: benedikt
6
 * Date: 12/3/17
7
 * Time: 5:55 PM
8
 */
9
10
namespace Tfboe\FmLib\Entity\Traits;
11
12
13
use Doctrine\ORM\Mapping as ORM;
14
use Tfboe\FmLib\Entity\Helpers\UUIDEntity;
15
use Tfboe\FmLib\Entity\PhaseInterface;
16
17
18
/**
19
 * Trait QualificationSystem
20
 * @package Tfboe\FmLib\Entity\Traits
21
 */
22
trait QualificationSystem
23
{
24
  use UUIDEntity;
25
26
//<editor-fold desc="Fields">
27
  /**
28
   * @ORM\ManyToOne(targetEntity="\Tfboe\FmLib\Entity\PhaseInterface", inversedBy="postQualifications")
29
   * @var PhaseInterface
30
   */
31
  private $previousPhase;
32
33
  /**
34
   * @ORM\ManyToOne(targetEntity="\Tfboe\FmLib\Entity\PhaseInterface", inversedBy="preQualifications")
35
   * @var PhaseInterface
36
   */
37
  private $nextPhase;
38
//</editor-fold desc="Fields">
39
40
//<editor-fold desc="Public Methods">
41
  /**
42
   * @return PhaseInterface
43
   */
44
  public function getNextPhase(): PhaseInterface
45
  {
46
    return $this->nextPhase;
47
  }
48
49
  /**
50
   * @return PhaseInterface
51
   */
52
  public function getPreviousPhase(): PhaseInterface
53
  {
54
    return $this->previousPhase;
55
  }
56
57
  /**
58
   * @param PhaseInterface $nextPhase
59
   */
60
  public function setNextPhase(PhaseInterface $nextPhase)
61
  {
62
    if ($this->nextPhase !== null) {
63
      $this->nextPhase->getPreQualifications()->removeElement($this);
64
    }
65
    $this->nextPhase = $nextPhase;
66
    $nextPhase->getPreQualifications()->add($this);
67
  }
68
69
  /**
70
   * @param PhaseInterface $previousPhase
71
   */
72
  public function setPreviousPhase(PhaseInterface $previousPhase)
73
  {
74
    if ($this->previousPhase !== null) {
75
      $this->previousPhase->getPostQualifications()->removeElement($this);
76
    }
77
    $this->previousPhase = $previousPhase;
78
    $previousPhase->getPostQualifications()->add($this);
79
  }
80
//</editor-fold desc="Public Methods">
81
}