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

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

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
 * This file is part of the PHPMongo package.
5
 *
6
 * (c) Dmytro Sokil <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sokil\Mongo;
13
14
class Paginator implements \Iterator
15
{
16
    private $currentPage = 1;
17
    
18
    private $itemsOnPage = 30;
19
    
20
    private $totalRowsCount;
21
    
22
    /**
23
     *
24
     * @var \Sokil\Mongo\Cursor
25
     */
26
    private $cursor;
27
    
28
    public function __construct(Cursor $cursor = null)
29
    {
30
        if ($cursor !== null) {
31
            $this->setCursor($cursor);
32
        }
33
    }
34
    
35
    public function __destruct()
36
    {
37
        $this->cursor = null;
38
    }
39
    
40
    /**
41
     *
42
     * @param int $itemsOnPage
43
     * @return Paginator
44
     */
45
    public function setItemsOnPage($itemsOnPage)
46
    {
47
        $this->itemsOnPage = (int) $itemsOnPage;
48
        
49
        // define offset
50
        $this->applyLimits();
51
        
52
        return $this;
53
    }
54
    
55
    /**
56
     *
57
     * @param int $currentPage
58
     * @return \Sokil\Mongo\Paginator
59
     */
60
    public function setCurrentPage($currentPage)
61
    {
62
        $this->currentPage = (int) $currentPage;
63
        
64
        // define offset
65
        $this->applyLimits();
66
        
67
        return $this;
68
    }
69
    
70
    public function getCurrentPage()
71
    {
72
        // check if current page number greater than max allowed
73
        $totalPageCount = $this->getTotalPagesCount();
74
        
75
        // no document found - page is 1
76
        if (0 === $totalPageCount) {
77
            return 1;
78
        }
79
        
80
        if ($this->currentPage <= $totalPageCount) {
81
            $currentPage = $this->currentPage;
82
        } else {
83
            $currentPage = $totalPageCount;
84
        }
85
        
86
        return $currentPage;
87
    }
88
    
89
    /**
90
     * Define cursor for paginator
91
     *
92
     * @param \Sokil\Mongo\Cursor $cursor
93
     * @return \Sokil\Mongo\Paginator
94
     */
95
    public function setCursor(Cursor $cursor)
96
    {
97
        $this->cursor = clone $cursor;
98
        
99
        $this->applyLimits();
100
        
101
        return $this;
102
    }
103
    
104
    public function getTotalRowsCount()
105
    {
106
        if (null !== $this->totalRowsCount) {
107
            return $this->totalRowsCount;
108
        }
109
        
110
        $this->totalRowsCount = $this->cursor->count();
111
        
112
        return $this->totalRowsCount;
113
    }
114
115
    /**
116
     * @return int
117
     */
118
    public function getTotalPagesCount()
119
    {
120
        return (int) ceil($this->getTotalRowsCount() / $this->itemsOnPage);
121
    }
122
    
123
    private function applyLimits()
124
    {
125
        if (!$this->cursor) {
126
            return;
127
        }
128
        
129
        $currentPage = $this->getCurrentPage();
130
        
131
        // get page of rows
132
        $this->cursor
133
            ->limit($this->itemsOnPage)
134
            ->skip(($currentPage - 1) * $this->itemsOnPage);
135
    }
136
137
    /**
138
     * @return void
139
     */
140
    public function rewind()
141
    {
142
        $this->cursor->rewind();
143
    }
144
145
    /**
146
     * @return bool
147
     */
148
    public function valid()
149
    {
150
        return $this->cursor->valid();
151
    }
152
153
    /**
154
     * @return Document
155
     */
156
    public function current()
157
    {
158
        return $this->cursor->current();
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->cursor->current(); of type null|array|Sokil\Mongo\Document adds the type array to the return on line 158 which is incompatible with the return type documented by Sokil\Mongo\Paginator::current of type Sokil\Mongo\Document|null.
Loading history...
159
    }
160
161
    /**
162
     * @return string
163
     */
164
    public function key()
165
    {
166
        return $this->cursor->key();
167
    }
168
169
    /**
170
     * @return void
171
     */
172
    public function next()
173
    {
174
        $this->cursor->next();
175
    }
176
}
177