Issues (82)

Security Analysis    not enabled

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.

Model/RestPaginator.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
namespace Pgs\RestfonyBundle\Model;
4
5
use Hateoas\Configuration\Route;
6
use JMS\Serializer\Annotation as Serializer;
7
use Hateoas\Configuration\Annotation as Hateoas;
8
use Knp\Component\Pager\Pagination\AbstractPagination;
9
10
/**
11
 * @Serializer\ExclusionPolicy("all")
12
 *
13
 * @Hateoas\Relation(
14
 *      "first",
15
 *      href = "expr(object.getFirstLink())",
16
 *      exclusion = @Hateoas\Exclusion(groups = {"list"})
17
 * )
18
 *
19
 * @Hateoas\Relation(
20
 *      "self",
21
 *      href = "expr(object.getSelfLink())",
22
 *      exclusion = @Hateoas\Exclusion(groups = {"list"})
23
 * )
24
 *
25
 * @Hateoas\Relation(
26
 *      "last",
27
 *      href = "expr(object.getLastLink())",
28
 *      exclusion = @Hateoas\Exclusion(groups = {"list"})
29
 * )
30
 *
31
 * @author Michał Sikora
32
 */
33
class RestPaginator
34
{
35
    /**
36
     * @var int
37
     * @Serializer\Expose
38
     * @Serializer\Groups({"list"})
39
     * @Serializer\XmlAttribute
40
     */
41
    private $page;
42
43
    /**
44
     * @var int
45
     * @Serializer\Expose
46
     * @Serializer\Groups({"list"})
47
     * @Serializer\XmlAttribute
48
     */
49
    private $limit;
50
51
    /**
52
     * @var int
53
     * @Serializer\Expose
54
     * @Serializer\Groups({"list"})
55
     * @Serializer\XmlAttribute
56
     */
57
    private $pages;
58
59
    /**
60
     * @var int
61
     * @Serializer\Expose
62
     * @Serializer\Groups({"list"})
63
     */
64
    private $total;
65
66
    /**
67
     * @var int
68
     * @Serializer\Expose
69
     * @Serializer\Groups({"list"})
70
     */
71
    private $items = [];
72
73
    /**
74
     * @param $page
75
     * @param AbstractPagination $paginationView
76
     * @param RelationPaginator  $relationPaginator
77
     */
78 1
    public function __construct($page, AbstractPagination $paginationView, RelationPaginator $relationPaginator)
79
    {
80 1
        $this->page = $page;
81 1
        $this->limit = $paginationView->getItemNumberPerPage();
82 1
        $this->total = $paginationView->getTotalItemCount();
83 1
        $this->items = $paginationView->getItems();
0 ignored issues
show
Documentation Bug introduced by
It seems like $paginationView->getItems() of type array is incompatible with the declared type integer of property $items.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
84 1
        $this->pages = (int) ceil($paginationView->getTotalItemCount() / $paginationView->getItemNumberPerPage());
85 1
        $this->relationPaginator = $relationPaginator;
0 ignored issues
show
The property relationPaginator does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
86 1
    }
87
88
    /**
89
     * @return int
90
     */
91 1
    public function getPage()
92
    {
93 1
        return $this->page;
94
    }
95
96
    /**
97
     * @return int
98
     */
99 1
    public function getLimit()
100
    {
101 1
        return $this->limit;
102
    }
103
104
    /**
105
     * @return int
106
     */
107 1
    public function getPages()
108
    {
109 1
        return $this->pages;
110
    }
111
112
    /**
113
     * @return int
114
     */
115 1
    public function getTotal()
116
    {
117 1
        return $this->total;
118
    }
119
120
    /**
121
     * @return array
122
     */
123 1
    public function getItems()
124
    {
125 1
        return $this->items;
126
    }
127
128
    /**
129
     * @return Route
130
     */
131 1
    public function getFirstLink()
132
    {
133 1
        return $this->relationPaginator->getFirst();
134
    }
135
136
    /**
137
     * @return Route
138
     */
139 1
    public function getLastLink()
140
    {
141 1
        return $this->relationPaginator->getLast();
142
    }
143
144
    /**
145
     * @return Route
146
     */
147 1
    public function getSelfLink()
148
    {
149 1
        return $this->relationPaginator->getSelf();
150
    }
151
152
    /**
153
     * @param int $items
154
     *
155
     * @return $this
156
     */
157 1
    public function setItems($items)
158
    {
159 1
        $this->items = $items;
160 1
    }
161
162
    /**
163
     * @param int $total
164
     *
165
     * @return $this
166
     */
167 1
    public function setTotal($total)
168
    {
169 1
        $this->total = $total;
170 1
    }
171
172
    /**
173
     * @param int $pages
174
     *
175
     * @return $this
176
     */
177 1
    public function setPages($pages)
178
    {
179 1
        $this->pages = $pages;
180 1
    }
181
182
    /**
183
     * @param int $limit
184
     *
185
     * @return $this
186
     */
187 1
    public function setLimit($limit)
188
    {
189 1
        $this->limit = $limit;
190 1
    }
191
192
    /**
193
     * @param int $page
194
     *
195
     * @return $this
196
     */
197 1
    public function setPage($page)
198
    {
199 1
        $this->page = $page;
200 1
    }
201
}
202