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.

Issues (42)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Constraint/ConstraintManager.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * @file
5
 * Class ConstraintManager
6
 */
7
8
namespace Roomify\Bat\Constraint;
9
10
class ConstraintManager {
11
12
  protected $constraints;
13
14
  /**
15
   * @param $constraints
16
   */
17
  public function __construct($constraints = array()) {
18
    $this->constraints = array();
19
    foreach ($constraints as $constraint) {
20
      $this->constraints[get_class($constraint)][] = $constraint;
21
    }
22
  }
23
24
  /**
25
   * @return array
26
   */
27
  public function getConstraints($constraint_class = NULL) {
28
    if ($constraint_class == NULL) {
29
      return $this->constraints;
30
    } else {
31
      return $this->constraints[$constraint_class];
32
    }
33
  }
34
35
  /**
36
   * @param $constraints
37
   */
38
  public function addConstraints($constraints) {
39
    foreach ($constraints as $constraint) {
40
      $this->constraints[get_class($constraint)][] = $constraint;
41
    }
42
  }
43
44
  /**
45
   * @param $constraints
46
   */
47
  public function setConstraints($constraints) {
48
    $this->constraints = array();
49
    $this->addConstraints($constraints);
50
  }
51
52
  /**
53
   * @param $constraint_class
54
   *
55
   * @return array
56
   */
57
  public function normalizeConstraints($constraint_class = NULL) {
58
    if ($constraint_class == NULL) {
59
      $classes = array_keys($this->constraints);
60
    } else {
61
      if (isset($this->constraints[$constraint_class])) {
62
        $classes = array($constraint_class);
63
      } else {
64
        return array();
65
      }
66
    }
67
68
    $new_constraints = array();
69
70
    foreach ($classes as $class) {
71
      switch ($class) {
72
        case 'Roomify\Bat\Constraint\MinMaxDaysConstraint':
73
          $new_constraints[$class] = $this->normalizeMinMaxDaysConstraints();
74
          break;
75
76
        case 'Roomify\Bat\Constraint\CheckInDayConstraint':
77
          $new_constraints[$class] = $this->normalizeCheckInDayConstraints();
78
          break;
79
80
        default:
81
          if (isset($this->constraints[$class])) {
82
            $new_constraints[$class] = $this->constraints[$class];
83
          }
84
      }
85
    }
86
87
    if ($constraint_class == NULL) {
88
      return $new_constraints;
89
    } else {
90
      return $new_constraints[$constraint_class];
91
    }
92
  }
93
94
  /**
95
   * @return array
96
   */
97
  protected function normalizeMinMaxDaysConstraints() {
98
    $new_constraints = array();
99
100
    $constraints = array_map(function ($object) { return clone $object; }, $this->constraints['Roomify\Bat\Constraint\MinMaxDaysConstraint']);
101
102
    foreach (array_reverse($constraints) as $constraint) {
103
      $start_date = $constraint->getStartDate();
104
      $end_date = $constraint->getEndDate();
105
106
      $split_constraint = NULL;
107
108
      if (!empty($new_constraints)) {
109
        foreach ($new_constraints as $new_constraint) {
110
          $new_start_date = $new_constraint->getStartDate();
111
          $new_end_date = $new_constraint->getEndDate();
112
113
          if ($constraint->getMinDays() && $new_constraint->getMinDays() ||
114
              ($constraint->getMaxDays() && $new_constraint->getMaxDays())) {
115 View Code Duplication
            if ($start_date >= $new_start_date && $start_date <= $new_end_date) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
116
              $new_end_date_clone = clone($new_end_date);
117
              $constraint->setStartDate($new_end_date_clone->add(new \DateInterval('P1D')));
118
            }
119
            elseif ($end_date >= $new_start_date && $end_date <= $new_end_date) {
120
              $new_start_date_clone = clone($new_start_date);
121
              $constraint->setEndDate($new_start_date_clone->sub(new \DateInterval('P1D')));
122
            }
123
            elseif ($start_date < $new_start_date && $end_date > $new_end_date) {
124
              if ($constraint->getEndDate() > $new_start_date) {
125
                $new_start_date_clone = clone($new_start_date);
126
                $constraint->setEndDate($new_start_date_clone->sub(new \DateInterval('P1D')));
127
              }
128
129
              if ($split_constraint == NULL) {
130
                $split_start_date = clone($new_end_date);
131
                $split_start_date->add(new \DateInterval('P1D'));
132
                $split_end_date = $end_date;
133
134
                $split_constraint = new MinMaxDaysConstraint($constraint->getUnits(), $constraint->getMinDays(), $constraint->getMaxDays(), $split_start_date, $split_end_date, $constraint->getCheckinDay());
135
              }
136
              else {
137
                $split_start_date = $split_constraint->getStartDate();
138
                $split_end_date = $split_constraint->getEndDate();
139
140
                if ($split_start_date < $new_end_date) {
141
                  $new_end_date_clone = clone($new_end_date);
142
                  $split_constraint->setStartDate($new_end_date_clone->add(new \DateInterval('P1D')));
143
                }
144
                if ($split_end_date < $new_start_date) {
145
                  $new_start_date_clone = clone($new_start_date);
146
                  $split_constraint->setEndDate($new_start_date_clone->sub(new \DateInterval('P1D')));
147
                }
148
              }
149
            }
150
          }
151
        }
152
153
        if ($split_constraint != NULL) {
154
          $new_constraints[] = $split_constraint;
155
        }
156
      }
157
158
      $new_constraints[] = $constraint;
159
    }
160
161
    foreach ($new_constraints as $i => $constraint) {
162
      if ($constraint->getStartDate() > $constraint->getEndDate()) {
163
        unset($new_constraints[$i]);
164
      }
165
    }
166
167
    return $new_constraints;
168
  }
169
170
  /**
171
   * @return array
172
   */
173
  protected function normalizeCheckInDayConstraints() {
174
    $new_constraints = array();
175
176
    $constraints = array_map(function ($object) { return clone $object; }, $this->constraints['Roomify\Bat\Constraint\CheckInDayConstraint']);
177
178
    foreach (array_reverse($constraints) as $constraint) {
179
      $start_date = $constraint->getStartDate();
180
      $end_date = $constraint->getEndDate();
181
182
      $split_constraint = NULL;
183
184
      if (!empty($new_constraints)) {
185
        foreach ($new_constraints as $new_constraint) {
186
          $new_start_date = $new_constraint->getStartDate();
187
          $new_end_date = $new_constraint->getEndDate();
188
189 View Code Duplication
          if ($constraint->getCheckinDay() && $new_constraint->getCheckinDay()) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
190
            if ($start_date >= $new_start_date && $start_date <= $new_end_date) {
191
              $new_end_date_clone = clone($new_end_date);
192
              $constraint->setStartDate($new_end_date_clone->add(new \DateInterval('P1D')));
193
            } elseif ($end_date >= $new_start_date && $end_date <= $new_end_date) {
194
              $new_start_date_clone = clone($new_start_date);
195
              $constraint->setEndDate($new_start_date_clone->sub(new \DateInterval('P1D')));
196
            } elseif ($start_date < $new_start_date && $end_date > $new_end_date) {
197
              if ($constraint->getEndDate() > $new_start_date) {
198
                $new_start_date_clone = clone($new_start_date);
199
                $constraint->setEndDate($new_start_date_clone->sub(new \DateInterval('P1D')));
200
              }
201
202
              if ($split_constraint == NULL) {
203
                $split_start_date = clone($new_end_date);
204
                $split_start_date->add(new \DateInterval('P1D'));
205
                $split_end_date = $end_date;
206
207
                $split_constraint = new CheckInDayConstraint($constraint->getUnits(), $constraint->getCheckinDay(), $split_start_date, $split_end_date);
208
              } else {
209
                $split_start_date = $split_constraint->getStartDate();
210
                $split_end_date = $split_constraint->getEndDate();
211
212
                if ($split_start_date < $new_end_date) {
213
                  $new_end_date_clone = clone($new_end_date);
214
                  $split_constraint->setStartDate($new_end_date_clone->add(new \DateInterval('P1D')));
215
                }
216
                if ($split_end_date < $new_start_date) {
217
                  $new_start_date_clone = clone($new_start_date);
218
                  $split_constraint->setEndDate($new_start_date_clone->sub(new \DateInterval('P1D')));
219
                }
220
              }
221
            }
222
          }
223
        }
224
225
        if ($split_constraint != NULL) {
226
          $new_constraints[] = $split_constraint;
227
        }
228
      }
229
230
      $new_constraints[] = $constraint;
231
    }
232
233
    foreach ($new_constraints as $i => $constraint) {
234
      if ($constraint->getStartDate() > $constraint->getEndDate()) {
235
        unset($new_constraints[$i]);
236
      }
237
    }
238
239
    return $new_constraints;
240
  }
241
  
242
}
243