Issues (197)

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/Contracts/Api/CrudInterface.php (12 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 declare (strict_types = 1);
2
3
namespace Limoncello\Flute\Contracts\Api;
4
5
/**
6
 * Copyright 2015-2019 [email protected]
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 * http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20
21
use Closure;
22
use Doctrine\DBAL\Query\QueryBuilder;
23
use Limoncello\Flute\Contracts\Models\PaginatedDataInterface;
24
25
/**
26
 * @package Limoncello\Flute
27
 */
28
interface CrudInterface
29
{
30
    /**
31
     * @return self
0 ignored issues
show
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
32
     */
33
    public function combineWithAnd(): self;
34
35
    /**
36
     * @return self
0 ignored issues
show
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
37
     */
38
    public function combineWithOr(): self;
39
40
    /**
41
     * @param iterable $filterParameters
42
     *
43
     * @return self
0 ignored issues
show
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
44
     */
45
    public function withFilters(iterable $filterParameters): self;
46
47
    /**
48
     * @param string $index
49
     *
50
     * @return self
0 ignored issues
show
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
51
     */
52
    public function withIndexFilter(string $index): self;
53
54
    /**
55
     * @param array $indexes
56
     *
57
     * @return self
0 ignored issues
show
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
58
     */
59
    public function withIndexesFilter(array $indexes): self;
60
61
    /**
62
     * @param iterable $sortingParameters
63
     *
64
     * @return self
0 ignored issues
show
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
65
     */
66
    public function withSorts(iterable $sortingParameters): self;
67
68
    /**
69
     * @param iterable $includePaths
70
     *
71
     * @return self
0 ignored issues
show
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
72
     */
73
    public function withIncludes(iterable $includePaths): self;
74
75
    /**
76
     * @param int $offset
77
     * @param int $limit
78
     *
79
     * @return self
0 ignored issues
show
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
80
     */
81
    public function withPaging(int $offset, int $limit): self;
82
83
    /**
84
     * @return self
0 ignored issues
show
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
85
     */
86
    public function withoutPaging(): self;
87
88
    /**
89
     * @param string   $name
90
     * @param iterable $filters
91
     *
92
     * @return CrudInterface
0 ignored issues
show
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
93
     */
94
    public function withRelationshipFilters(string $name, iterable $filters): self;
95
96
    /**
97
     * @param string   $name
98
     * @param iterable $sorts
99
     *
100
     * @return CrudInterface
0 ignored issues
show
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
101
     */
102
    public function withRelationshipSorts(string $name, iterable $sorts): self;
103
104
    /**
105
     * @param iterable|null $columns
106
     *
107
     * @return QueryBuilder
108
     */
109
    public function createIndexBuilder(iterable $columns = null): QueryBuilder;
110
111
    /**
112
     * @return QueryBuilder
113
     */
114
    public function createDeleteBuilder(): QueryBuilder;
115
116
    /**
117
     * @param QueryBuilder $builder
118
     * @param string       $modelClass
119
     *
120
     * @return PaginatedDataInterface
121
     */
122
    public function fetchResources(QueryBuilder $builder, string $modelClass): PaginatedDataInterface;
123
124
    /**
125
     * @param QueryBuilder|null $builder
0 ignored issues
show
Consider making the type for parameter $builder a bit more specific; maybe use QueryBuilder.
Loading history...
126
     * @param string|null       $modelClass
127
     *
128
     * @return mixed|null
129
     */
130
    public function fetchResource(QueryBuilder $builder, string $modelClass);
131
132
    /**
133
     * @param QueryBuilder $builder
134
     * @param string       $modelClass
135
     *
136
     * @return array|null
137
     */
138
    public function fetchRow(QueryBuilder $builder, string $modelClass): ?array;
139
140
    /**
141
     * @param QueryBuilder $builder
142
     * @param string       $modelClass
143
     * @param string       $columnName
144
     *
145
     * @return iterable
146
     */
147
    public function fetchColumn(QueryBuilder $builder, string $modelClass, string $columnName): iterable;
148
149
    /**
150
     * @return PaginatedDataInterface
151
     */
152
    public function index(): PaginatedDataInterface;
153
154
    /**
155
     * @return array
156
     */
157
    public function indexIdentities(): array;
158
159
    /**
160
     * @param string $index
161
     *
162
     * @return mixed|null
163
     */
164
    public function read(string $index);
165
166
    /**
167
     * @return int|null
168
     */
169
    public function count(): ?int;
170
171
    /**
172
     * @return int
173
     */
174
    public function delete(): int;
175
176
    /**
177
     * @param string $index
178
     *
179
     * @return bool
180
     */
181
    public function remove(string $index): bool;
182
183
    /**
184
     * @param null|string $index
185
     * @param array       $attributes
186
     * @param array       $toMany
187
     *
188
     * @return string
189
     */
190
    public function create(?string $index, array $attributes, array $toMany): string;
191
192
    /**
193
     * @param string $index
194
     * @param array  $attributes
195
     * @param array  $toMany
196
     *
197
     * @return int
198
     */
199
    public function update(string $index, array $attributes, array $toMany): int;
200
201
    /**
202
     * @param string        $name
203
     * @param iterable|null $relationshipFilters
204
     * @param iterable|null $relationshipSorts
205
     *
206
     * @return PaginatedDataInterface|mixed|null
207
     */
208
    public function indexRelationship(
209
        string $name,
210
        iterable $relationshipFilters = null,
211
        iterable $relationshipSorts = null
212
    );
213
214
    /**
215
     * @param string        $name
216
     * @param iterable|null $relationshipFilters
217
     * @param iterable|null $relationshipSorts
218
     *
219
     * @return array
220
     */
221
    public function indexRelationshipIdentities(
222
        string $name,
223
        iterable $relationshipFilters = null,
224
        iterable $relationshipSorts = null
225
    ): array;
226
227
    /**
228
     * @param string        $index
229
     * @param string        $name
230
     * @param iterable|null $relationshipFilters
231
     * @param iterable|null $relationshipSorts
232
     *
233
     * @return PaginatedDataInterface|mixed|null
234
     */
235
    public function readRelationship(
236
        string $index,
237
        string $name,
238
        iterable $relationshipFilters = null,
239
        iterable $relationshipSorts = null
240
    );
241
242
    /**
243
     * @param string $parentId
244
     * @param string $name
245
     * @param string $childId
246
     *
247
     * @return bool
248
     */
249
    public function hasInRelationship(string $parentId, string $name, string $childId): bool;
250
251
    /**
252
     * @param string   $parentId
253
     * @param string   $name
254
     * @param iterable $childIds
255
     *
256
     * @return int
257
     */
258
    public function createInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int;
259
260
    /**
261
     * @param string   $parentId
262
     * @param string   $name
263
     * @param iterable $childIds
264
     *
265
     * @return int
266
     */
267
    public function removeInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int;
268
269
    /**
270
     * @param Closure $closure
271
     */
272
    public function inTransaction(Closure $closure): void;
273
}
274