GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AbstractConstraint   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Coupling/Cohesion

Components 4
Dependencies 0

Importance

Changes 0
Metric Value
wmc 8
lcom 4
cbo 0
dl 0
loc 82
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setStartDate() 0 3 1
A getStartDate() 0 3 1
A setEndDate() 0 3 1
A getEndDate() 0 3 1
A getAffectedUnits() 0 3 1
A getUnits() 0 8 2
A applyConstraint() 0 3 1
1
<?php
2
3
/**
4
 * @file
5
 * Class AbstractConstraint
6
 */
7
8
namespace Roomify\Bat\Constraint;
9
10
use Roomify\Bat\Calendar\CalendarResponse;
11
use Roomify\Bat\Constraint\ConstraintInterface;
12
13
/**
14
 * A constraint acts as a filter that can be applied to a Calendar Response to
15
 * further reduce the set of matching units based on criteria beyond their
16
 * specific state over the time range the Calendar was queried.
17
 */
18
abstract class AbstractConstraint implements ConstraintInterface {
19
20
  /**
21
   * @var \DateTime
22
   */
23
  protected $start_date;
24
25
  /**
26
   * @var \DateTime
27
   */
28
  protected $end_date;
29
30
  /**
31
   * @var array
32
   */
33
  protected $affected_units;
34
35
  /**
36
   * @var CalendarResponse
37
   */
38
  protected $calendar_response;
39
40
  /**
41
   * @var array
42
   */
43
  protected $units = array();
44
45
  /**
46
   * {@inheritdoc}
47
   */
48
  public function setStartDate(\DateTime $start_date) {
49
    $this->start_date = clone($start_date);
50
  }
51
52
  /**
53
   * {@inheritdoc}
54
   */
55
  public function getStartDate() {
56
    return clone($this->start_date);
57
  }
58
59
  /**
60
   * {@inheritdoc}
61
   */
62
  public function setEndDate(\DateTime $end_date) {
63
    $this->end_date = clone($end_date);
64
  }
65
66
  /**
67
   * {@inheritdoc}
68
   */
69
  public function getEndDate() {
70
    return clone($this->end_date);
71
  }
72
73
  /**
74
   * {@inheritdoc}
75
   */
76
  public function getAffectedUnits() {
77
    return $this->affected_units;
78
  }
79
80
  /**
81
   * {@inheritdoc}
82
   */
83
  public function getUnits() {
84
    $keyed_units = array();
85
    foreach ($this->units as $unit) {
86
      $keyed_units[$unit->getUnitId()] = $unit;
87
    }
88
89
    return $keyed_units;
90
  }
91
92
  /**
93
   * {@inheritdoc}
94
   */
95
  public function applyConstraint(CalendarResponse &$calendar_response) {
96
    $this->calendar_response = $calendar_response;
97
  }
98
99
}
100