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 (20)

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/PeriodCollection.php (1 issue)

Labels
Severity

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
namespace Spatie\Period;
4
5
use ArrayAccess;
6
use Closure;
7
use Countable;
8
use Iterator;
9
10
class PeriodCollection implements ArrayAccess, Iterator, Countable
11
{
12
    use IterableImplementation;
13
14
    /** @var \Spatie\Period\Period[] */
15
    protected $periods;
16
17
    /**
18
     * @param \Spatie\Period\Period ...$periods
19
     *
20
     * @return static
21
     */
22
    public static function make(Period ...$periods): PeriodCollection
23
    {
24
        return new static(...$periods);
25
    }
26
27
    public function __construct(Period ...$periods)
28
    {
29
        $this->periods = $periods;
30
    }
31
32
    public function current(): Period
33
    {
34
        return $this->periods[$this->position];
35
    }
36
37
    /**
38
     * @param \Spatie\Period\PeriodCollection $periodCollection
39
     *
40
     * @return static
41
     */
42
    public function overlapSingle(PeriodCollection $periodCollection): PeriodCollection
43
    {
44
        $overlaps = static::make();
45
46
        foreach ($this as $period) {
47
            foreach ($periodCollection as $otherPeriod) {
48
                if (! $period->overlapSingle($otherPeriod)) {
49
                    continue;
50
                }
51
52
                $overlaps[] = $period->overlapSingle($otherPeriod);
53
            }
54
        }
55
56
        return $overlaps;
57
    }
58
59
    /**
60
     * @param \Spatie\Period\PeriodCollection ...$periodCollections
61
     *
62
     * @return static
63
     */
64
    public function overlap(PeriodCollection ...$periodCollections): PeriodCollection
65
    {
66
        $overlap = clone $this;
67
68
        foreach ($periodCollections as $periodCollection) {
69
            $overlap = $overlap->overlapSingle($periodCollection);
70
        }
71
72
        return $overlap;
73
    }
74
75
    public function boundaries(): ?Period
76
    {
77
        $start = null;
78
        $end = null;
79
80
        foreach ($this as $period) {
81
            if ($start === null || $start > $period->getIncludedStart()) {
82
                $start = $period->getIncludedStart();
83
            }
84
85
            if ($end === null || $end < $period->getIncludedEnd()) {
86
                $end = $period->getIncludedEnd();
87
            }
88
        }
89
90
        if (! $start || ! $end) {
91
            return null;
92
        }
93
94
        [$firstPeriod] = $this->periods;
0 ignored issues
show
The variable $firstPeriod does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
95
96
        return new Period(
97
            $start,
98
            $end,
99
            $firstPeriod->getPrecisionMask(),
100
            Boundaries::EXCLUDE_NONE
101
        );
102
    }
103
104
    /**
105
     * @return static
106
     */
107
    public function gaps(): PeriodCollection
108
    {
109
        $boundaries = $this->boundaries();
110
111
        if (! $boundaries) {
112
            return static::make();
113
        }
114
115
        return $boundaries->diff(...$this);
116
    }
117
118
    /**
119
     * @param \Spatie\Period\Period $intersection
120
     *
121
     * @return static
122
     */
123
    public function intersect(Period $intersection): PeriodCollection
124
    {
125
        $intersected = static::make();
126
127
        foreach ($this as $period) {
128
            $overlap = $intersection->overlapSingle($period);
129
130
            if ($overlap === null) {
131
                continue;
132
            }
133
134
            $intersected[] = $overlap;
135
        }
136
137
        return $intersected;
138
    }
139
140
    /**
141
     * @param \Spatie\Period\Period ...$periods
142
     *
143
     * @return static
144
     */
145
    public function add(Period ...$periods): PeriodCollection
146
    {
147
        $collection = clone $this;
148
149
        foreach ($periods as $period) {
150
            $collection[] = $period;
151
        }
152
153
        return $collection;
154
    }
155
156
    /**
157
     * @param \Closure $closure
158
     *
159
     * @return static
160
     */
161
    public function map(Closure $closure): PeriodCollection
162
    {
163
        $collection = clone $this;
164
165
        foreach ($collection->periods as $key => $period) {
166
            $collection->periods[$key] = $closure($period);
167
        }
168
169
        return $collection;
170
    }
171
172
    /**
173
     * @param \Closure $closure
174
     * @param mixed $initial
175
     *
176
     * @return mixed|null
177
     */
178
    public function reduce(Closure $closure, $initial = null)
179
    {
180
        $carry = $initial;
181
182
        foreach ($this as $period) {
183
            $carry = $closure($carry, $period);
184
        }
185
186
        return $carry;
187
    }
188
189
    /**
190
     * @param  \Closure  $closure
191
     *
192
     * @return static
193
     */
194
    public function filter(Closure $closure): PeriodCollection
195
    {
196
        $collection = clone $this;
197
198
        $collection->periods = array_filter($collection->periods, $closure);
199
200
        return $collection;
201
    }
202
203
    public function isEmpty(): bool
204
    {
205
        return count($this->periods) === 0;
206
    }
207
}
208