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

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/Vector.php (9 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
 * @license https://github.com/f500/equatable/blob/master/LICENSE MIT
5
 */
6
7
declare(strict_types=1);
8
9
namespace F500\Equatable;
10
11
use F500\Equatable\Exceptions\OutOfRangeException;
12
13
/**
14
 * @copyright Copyright (c) 2015 Future500 B.V.
15
 * @author    Jasper N. Brouwer <[email protected]>
16
 */
17
final class Vector extends Collection
18
{
19 273
    public function __construct(array $values = [])
20
    {
21 273
        foreach ($values as $value) {
22 240
            $this->guardAgainstInvalidValue($value);
23 237
            $this->items[] = $value;
24
        }
25 270
    }
26
27 3 View Code Duplication
    public function __clone()
0 ignored issues
show
This method seems to be duplicated in 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...
28
    {
29 3
        $items = [];
30
31 3
        foreach ($this->items as $item) {
32 3
            if (is_object($item)) {
33 3
                $items[] = clone $item;
34
            } else {
35 3
                $items[] = $item;
36
            }
37
        }
38
39 3
        $this->items = $items;
40 3
    }
41
42 81
    public function get(int $index)
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
43
    {
44 81
        if (!$this->containsIndex($index)) {
45 3
            throw OutOfRangeException::doesNotContainIndex($index);
46
        }
47
48 78
        return $this->items[$index];
49
    }
50
51 66 View Code Duplication
    public function search($value): int
0 ignored issues
show
This method seems to be duplicated in 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...
52
    {
53 66
        foreach ($this->items as $index => $item) {
54 63
            if ($this->theseAreEqual($item, $value)) {
55 63
                return $index;
56
            }
57
        }
58
59 33
        throw OutOfRangeException::doesNotContainValue($value);
60
    }
61
62 63
    public function equals($other): bool
63
    {
64 63
        if (!$other instanceof static) {
65 3
            return false;
66
        }
67
68 60
        if ($this->count() !== $other->count()) {
69 6
            return false;
70
        }
71
72 54
        foreach ($this->items as $item) {
73 45
            if ($this->countItem($item) !== $other->countItem($item)) {
74 45
                return false;
75
            }
76
        }
77
78 42
        return true;
79
    }
80
81 9
    public function add($value): self
82
    {
83 9
        $items = $this->items;
84
85 9
        $items[] = $value;
86
87 9
        return new self($items);
88
    }
89
90 12 View Code Duplication
    public function replace($searchValue, $replacementValue): self
0 ignored issues
show
This method seems to be duplicated in 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...
91
    {
92 12
        $items = $this->items;
93 12
        $index = $this->search($searchValue);
94
95 9
        $items[$index] = $replacementValue;
96
97 9
        return new self($items);
98
    }
99
100 12 View Code Duplication
    public function replaceAll($searchValue, $replacementValue): self
0 ignored issues
show
This method seems to be duplicated in 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...
101
    {
102 12
        $items   = $this->items;
103 12
        $indexes = $this->searchAll($searchValue);
104
105 12
        if ($indexes->isEmpty()) {
106 3
            return $this;
107
        }
108
109 9
        foreach ($indexes as $index) {
110 9
            $items[$index] = $replacementValue;
111
        }
112
113 9
        return new self($items);
114
    }
115
116 12 View Code Duplication
    public function remove($value): self
0 ignored issues
show
This method seems to be duplicated in 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...
117
    {
118 12
        $items = $this->items;
119 12
        $index = $this->search($value);
120
121 9
        unset($items[$index]);
122
123 9
        return new self($items);
124
    }
125
126 12 View Code Duplication
    public function removeAll($value): self
0 ignored issues
show
This method seems to be duplicated in 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...
127
    {
128 12
        $items   = $this->items;
129 12
        $indexes = $this->searchAll($value);
130
131 12
        if ($indexes->isEmpty()) {
132 3
            return $this;
133
        }
134
135 9
        foreach ($indexes as $index) {
136 9
            unset($items[$index]);
137
        }
138
139 9
        return new self($items);
140
    }
141
142 6
    public function merge(self $other): self
143
    {
144 6
        $items = array_merge($this->items, $other->items);
145
146 6
        return new self($items);
147
    }
148
149 6 View Code Duplication
    public function intersect(self $other): self
0 ignored issues
show
This method seems to be duplicated in 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...
150
    {
151 6
        $items = [];
152
153 6
        foreach ($this->items as $item) {
154 6
            if ($other->contains($item)) {
155 6
                $items[] = $item;
156
            }
157
        }
158
159 6
        return new self($items);
160
    }
161
162 6 View Code Duplication
    public function diff(self $other): self
0 ignored issues
show
This method seems to be duplicated in 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...
163
    {
164 6
        $items = [];
165
166 6
        foreach ($this->items as $item) {
167 6
            if (!$other->contains($item)) {
168 6
                $items[] = $item;
169
            }
170
        }
171
172 6
        return new self($items);
173
    }
174
175
    /**
176
     * The filter callable is given an item, and should return
177
     * a boolean indicating whether the item remains or not.
178
     *
179
     * function ($item): bool {
180
     *     return true;
181
     * }
182
     */
183 6
    public function filter(callable $filter): self
184
    {
185 6
        $items = array_filter($this->items, $filter);
186
187 6
        return new self($items);
188
    }
189
190
    /**
191
     * The mapper callable is given an item, and should return
192
     * a new value to use in it's place.
193
     *
194
     * function ($item) {
195
     *     return $item;
196
     * }
197
     */
198 6
    public function map(callable $mapper): self
199
    {
200 6
        $items = array_map($mapper, $this->items);
201
202 6
        return new self($items);
203
    }
204
205 81
    private function containsIndex(int $index): bool
206
    {
207 81
        return isset($this->items[$index]);
208
    }
209
}
210