Issues (36)

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.

Criteria.php (3 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
 * This file is part of the Cubiche package.
5
 *
6
 * Copyright (c) Cubiche
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
namespace Cubiche\Core\Specification;
12
13
use Cubiche\Core\Selector\Count;
14
use Cubiche\Core\Selector\Key;
15
use Cubiche\Core\Selector\Method;
16
use Cubiche\Core\Selector\Property;
17
use Cubiche\Core\Selector\This;
18
use Cubiche\Core\Selector\Value;
19
use Cubiche\Core\Selector\Callback;
20
21
/**
22
 * Criteria Class.
23
 *
24
 * @author Karel Osorio Ramírez <[email protected]>
25
 */
26
class Criteria
27
{
28
    /**
29
     * @var Selector
30
     */
31
    protected static $false = null;
32
33
    /**
34
     * @var Selector
35
     */
36
    protected static $true = null;
37
38
    /**
39
     * @var Selector
40
     */
41
    protected static $null = null;
42
43
    /**
44
     * @var Selector
45
     */
46
    protected static $self = null;
47
48
    /**
49
     * @return \Cubiche\Core\Specification\Selector
50
     */
51 View Code Duplication
    public static function false()
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
        if (self::$false === null) {
54
            self::$false = new Selector(new Value(false));
55
        }
56
57
        return self::$false;
58
    }
59
60
    /**
61
     * @return \Cubiche\Core\Specification\Selector
62
     */
63 View Code Duplication
    public static function true()
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...
64
    {
65
        if (self::$true === null) {
66
            self::$true = new Selector(new Value(true));
67
        }
68
69
        return self::$true;
70
    }
71
72
    /**
73
     * @return \Cubiche\Core\Specification\Selector
74
     */
75 View Code Duplication
    public static function null()
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...
76
    {
77
        if (self::$null === null) {
78
            self::$null = new Selector(new Value(null));
79
        }
80
81
        return self::$null;
82
    }
83
84
    /**
85
     * @param string $key
86
     *
87
     * @return \Cubiche\Core\Specification\Selector
88
     */
89
    public static function key($key)
90
    {
91
        return new Selector(new Key($key));
92
    }
93
94
    /**
95
     * @param string $property
96
     *
97
     * @return \Cubiche\Core\Specification\Selector
98
     */
99
    public static function property($property)
100
    {
101
        return new Selector(new Property($property));
102
    }
103
104
    /**
105
     * @param string $method
106
     *
107
     * @return \Cubiche\Core\Specification\Selector
108
     */
109
    public static function method($method)
110
    {
111
        return new Selector(new Method($method));
112
    }
113
114
    /**
115
     * @return \Cubiche\Core\Specification\Selector
116
     */
117
    public static function this()
118
    {
119
        if (self::$self === null) {
120
            self::$self = new Selector(new This());
121
        }
122
123
        return self::$self;
124
    }
125
126
    /**
127
     * @param callable $callable
128
     *
129
     * @return \Cubiche\Core\Specification\Selector
130
     */
131
    public static function callback(callable $callable)
132
    {
133
        return new Selector(new Callback($callable));
134
    }
135
136
    /**
137
     * @return \Cubiche\Core\Specification\Selector
138
     */
139
    public static function count()
140
    {
141
        return new Selector(new Count());
142
    }
143
144
    /**
145
     * @param SelectorInterface|mixed $value
146
     *
147
     * @return \Cubiche\Core\Specification\Constraint\GreaterThan
148
     */
149
    public static function gt($value)
150
    {
151
        return self::this()->gt($value);
152
    }
153
154
    /**
155
     * @param SelectorInterface|mixed $value
156
     *
157
     * @return \Cubiche\Core\Specification\Constraint\GreaterThanEqual
158
     */
159
    public static function gte($value)
160
    {
161
        return self::this()->gte($value);
162
    }
163
164
    /**
165
     * @param SelectorInterface|mixed $value
166
     *
167
     * @return \Cubiche\Core\Specification\Constraint\LessThan
168
     */
169
    public static function lt($value)
170
    {
171
        return self::this()->lt($value);
172
    }
173
174
    /**
175
     * @param SelectorInterface|mixed $value
176
     *
177
     * @return \Cubiche\Core\Specification\Constraint\LessThanEqual
178
     */
179
    public static function lte($value)
180
    {
181
        return self::this()->lte($value);
182
    }
183
184
    /**
185
     * @param SelectorInterface|mixed $value
186
     *
187
     * @return \Cubiche\Core\Specification\Constraint\Equal
188
     */
189
    public static function eq($value)
190
    {
191
        return self::this()->eq($value);
192
    }
193
194
    /**
195
     * @param SelectorInterface|mixed $value
196
     *
197
     * @return \Cubiche\Core\Specification\Constraint\NotEqual
198
     */
199
    public static function neq($value)
200
    {
201
        return self::this()->neq($value);
202
    }
203
204
    /**
205
     * @param SelectorInterface|mixed $value
206
     *
207
     * @return \Cubiche\Core\Specification\Constraint\Same
208
     */
209
    public static function same($value)
210
    {
211
        return self::this()->same($value);
212
    }
213
214
    /**
215
     * @param SelectorInterface|mixed $value
216
     *
217
     * @return \Cubiche\Core\Specification\Constraint\NotSame
218
     */
219
    public static function notSame($value)
220
    {
221
        return self::this()->notSame($value);
222
    }
223
224
    /**
225
     * @return \Cubiche\Core\Specification\Constraint\Same
226
     */
227
    public static function isNull()
228
    {
229
        return self::this()->isNull();
230
    }
231
232
    /**
233
     * @return \Cubiche\Core\Specification\Constraint\NotSame
234
     */
235
    public static function notNull()
236
    {
237
        return self::this()->notNull();
238
    }
239
240
    /**
241
     * @return \Cubiche\Core\Specification\Constraint\Same
242
     */
243
    public static function isTrue()
244
    {
245
        return self::this()->isTrue();
246
    }
247
248
    /**
249
     * @return \Cubiche\Core\Specification\Constraint\Same
250
     */
251
    public static function isFalse()
252
    {
253
        return self::this()->isFalse();
254
    }
255
256
    /**
257
     * @param SpecificationInterface $specification
258
     *
259
     * @return \Cubiche\Core\Specification\Quantifier\All
260
     */
261
    public static function all(SpecificationInterface $specification)
262
    {
263
        return self::this()->all($specification);
264
    }
265
266
    /**
267
     * @param int                    $count
268
     * @param SpecificationInterface $specification
269
     *
270
     * @return \Cubiche\Core\Specification\Quantifier\AtLeast
271
     */
272
    public static function atLeast($count, SpecificationInterface $specification)
273
    {
274
        return self::this()->atLeast($count, $specification);
275
    }
276
277
    /**
278
     * @param SpecificationInterface $specification
279
     *
280
     * @return \Cubiche\Core\Specification\Quantifier\AtLeast
281
     */
282
    public static function any(SpecificationInterface $specification)
283
    {
284
        return self::this()->any($specification);
285
    }
286
287
    /**
288
     * @param SpecificationInterface $specification
289
     *
290
     * @return \Cubiche\Core\Specification\SpecificationInterface
291
     */
292
    public static function not(SpecificationInterface $specification)
293
    {
294
        return $specification->not();
295
    }
296
}
297