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/Collection.php (4 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 ArrayIterator;
12
use Countable;
13
use F500\Equatable\Exceptions\InvalidArgumentException;
14
use F500\Equatable\Exceptions\OutOfRangeException;
15
use IteratorAggregate;
16
use Traversable;
17
18
/**
19
 * @copyright Copyright (c) 2015 Future500 B.V.
20
 * @author    Jasper N. Brouwer <[email protected]>
21
 */
22
abstract class Collection implements Equatable, Countable, IteratorAggregate
23
{
24
    protected $items = [];
25
26 63
    public function getIterator(): Traversable
27
    {
28 63
        return new ArrayIterator($this->items);
29
    }
30
31 78
    public function isEmpty(): bool
32
    {
33 78
        return !$this->items;
34
    }
35
36 282
    public function count(): int
37
    {
38 282
        return count($this->items);
39
    }
40
41 57
    public function countItem($value): int
42
    {
43 57
        $count = 0;
44
45 57
        foreach ($this->items as $item) {
46 57
            if ($this->theseAreEqual($item, $value)) {
47 57
                $count++;
48
            }
49
        }
50
51 57
        return $count;
52
    }
53
54 51
    public function contains($value): bool
55
    {
56
        try {
57 51
            $this->search($value);
58 42
            return true;
59 45
        } catch (OutOfRangeException $e) {
60 45
            return false;
61
        }
62
    }
63
64
    abstract public function search($value);
0 ignored issues
show
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
65
66 66
    public function searchAll($value): Vector
67
    {
68 66
        $foundPointers = [];
69
70 66
        foreach ($this->items as $pointer => $item) {
71 66
            if ($this->theseAreEqual($item, $value)) {
72 66
                $foundPointers[] = $pointer;
73
            }
74
        }
75
76 66
        return new Vector($foundPointers);
77
    }
78
79 6
    public function toArray(): array
80
    {
81 6
        return $this->items;
82
    }
83
84 12
    public function first()
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...
85
    {
86 12
        if ($this->isEmpty()) {
87 6
            throw OutOfRangeException::doesNotContainAnything();
88
        }
89
90 6
        return reset($this->items);
91
    }
92
93 12
    public function last()
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...
94
    {
95 12
        if ($this->isEmpty()) {
96 6
            throw OutOfRangeException::doesNotContainAnything();
97
        }
98
99 6
        return end($this->items);
100
    }
101
102
    /**
103
     * The reducer callable is given the carry value and an item,
104
     * and should return the value it is reduced to.
105
     *
106
     * function ($carry, $item) {
107
     *     return $carry . $item;
108
     * }
109
     */
110 12
    public function reduce(callable $reducer, $initial = null)
111
    {
112 12
        return array_reduce($this->items, $reducer, $initial);
113
    }
114
115 267
    protected function theseAreEqual($left, $right): bool
116
    {
117 267
        if ($left === $right) {
118 126
            return true;
119
        }
120
121 240
        if ($left instanceof Equatable && $left->equals($right)) {
0 ignored issues
show
This if statement, and the following return statement can be replaced with return $left instanceof ... $left->equals($right);.
Loading history...
122 111
            return true;
123
        }
124
125 207
        return false;
126
    }
127
128 462
    protected function guardAgainstInvalidValue($value)
129
    {
130 462
        if (!is_scalar($value) && !is_object($value)) {
131 6
            throw InvalidArgumentException::invalidValueInArray('values', 'scalar or object', $value);
132
        }
133 456
    }
134
}
135