This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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 UnderQuery package. |
||
5 | * |
||
6 | * Copyright (c) 2016 Beniamin Jonatan Šimko |
||
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 Phuria\UnderQuery; |
||
13 | |||
14 | use Doctrine\DBAL\Driver\Connection as ConnectionInterface; |
||
15 | use Phuria\UnderQuery\QueryBuilder\DeleteBuilder; |
||
16 | use Phuria\UnderQuery\QueryBuilder\InsertBuilder; |
||
17 | use Phuria\UnderQuery\QueryBuilder\InsertSelectBuilder; |
||
18 | use Phuria\UnderQuery\QueryBuilder\QueryBuilderFacade; |
||
19 | use Phuria\UnderQuery\QueryBuilder\SelectBuilder; |
||
20 | use Phuria\UnderQuery\QueryBuilder\UpdateBuilder; |
||
21 | use Phuria\UnderQuery\QueryCompiler\ConcreteCompiler\DeleteCompiler; |
||
22 | use Phuria\UnderQuery\QueryCompiler\ConcreteCompiler\InsertCompiler; |
||
23 | use Phuria\UnderQuery\QueryCompiler\ConcreteCompiler\SelectCompiler; |
||
24 | use Phuria\UnderQuery\QueryCompiler\ConcreteCompiler\UpdateCompiler; |
||
25 | use Phuria\UnderQuery\QueryCompiler\QueryCompiler; |
||
26 | use Phuria\UnderQuery\QueryCompiler\QueryCompilerInterface; |
||
27 | use Phuria\UnderQuery\TableFactory\TableFactory; |
||
28 | |||
29 | /** |
||
30 | * @author Beniamin Jonatan Šimko <[email protected]> |
||
31 | */ |
||
32 | class UnderQuery |
||
33 | { |
||
34 | /** |
||
35 | * @var QueryCompiler |
||
36 | */ |
||
37 | private $queryCompiler; |
||
38 | |||
39 | /** |
||
40 | * @var ConnectionInterface|null |
||
41 | */ |
||
42 | private $connection; |
||
43 | |||
44 | /** |
||
45 | * @param ConnectionInterface|null $connection |
||
46 | */ |
||
47 | 1 | public function __construct(ConnectionInterface $connection = null) |
|
48 | { |
||
49 | 1 | $this->connection = $connection; |
|
50 | 1 | $this->queryCompiler = $this->createQueryCompiler(); |
|
51 | 1 | $this->tableFactory = $this->createTableFactory(); |
|
0 ignored issues
–
show
|
|||
52 | |||
53 | 1 | $this->queryFacade = new QueryBuilderFacade( |
|
0 ignored issues
–
show
The property
queryFacade 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;
![]() |
|||
54 | 1 | $this->tableFactory, |
|
55 | 1 | $this->queryCompiler, |
|
56 | 1 | $this->connection |
|
57 | 1 | ); |
|
58 | 1 | } |
|
59 | |||
60 | /** |
||
61 | * @return ConnectionInterface|null |
||
62 | */ |
||
63 | public function getConnection() |
||
64 | { |
||
65 | return $this->connection; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @return QueryCompiler |
||
70 | */ |
||
71 | 1 | private function createQueryCompiler() |
|
72 | { |
||
73 | 1 | $queryCompiler = new QueryCompiler(); |
|
74 | 1 | $queryCompiler->addConcreteCompiler(new SelectCompiler()); |
|
75 | 1 | $queryCompiler->addConcreteCompiler(new InsertCompiler()); |
|
76 | 1 | $queryCompiler->addConcreteCompiler(new DeleteCompiler()); |
|
77 | 1 | $queryCompiler->addConcreteCompiler(new UpdateCompiler()); |
|
78 | |||
79 | 1 | return $queryCompiler; |
|
80 | } |
||
81 | |||
82 | /** |
||
83 | * @return TableFactory |
||
84 | */ |
||
85 | 1 | private function createTableFactory() |
|
86 | { |
||
87 | 1 | $tableFactory = new TableFactory(); |
|
88 | |||
89 | 1 | return $tableFactory; |
|
90 | } |
||
91 | |||
92 | /** |
||
93 | * @param string $class |
||
94 | * |
||
95 | * @return QueryCompilerInterface |
||
96 | */ |
||
97 | 1 | private function createQueryBuilder($class) |
|
98 | { |
||
99 | 1 | return new $class($this->queryFacade); |
|
100 | } |
||
101 | |||
102 | /** |
||
103 | * @return SelectBuilder |
||
0 ignored issues
–
show
|
|||
104 | */ |
||
105 | 1 | public function createSelect() |
|
106 | { |
||
107 | 1 | return $this->createQueryBuilder(SelectBuilder::class); |
|
108 | } |
||
109 | |||
110 | /** |
||
111 | * @return UpdateBuilder |
||
0 ignored issues
–
show
|
|||
112 | */ |
||
113 | 1 | public function createUpdate() |
|
114 | { |
||
115 | 1 | return $this->createQueryBuilder(UpdateBuilder::class); |
|
116 | } |
||
117 | |||
118 | /** |
||
119 | * @return DeleteBuilder |
||
0 ignored issues
–
show
|
|||
120 | */ |
||
121 | 1 | public function createDelete() |
|
122 | { |
||
123 | 1 | return $this->createQueryBuilder(DeleteBuilder::class); |
|
124 | } |
||
125 | |||
126 | /** |
||
127 | * @return InsertBuilder |
||
0 ignored issues
–
show
|
|||
128 | */ |
||
129 | 1 | public function createInsert() |
|
130 | { |
||
131 | 1 | return $this->createQueryBuilder(InsertBuilder::class); |
|
132 | } |
||
133 | |||
134 | /** |
||
135 | * @return InsertSelectBuilder |
||
0 ignored issues
–
show
|
|||
136 | */ |
||
137 | 1 | public function createInsertSelect() |
|
138 | { |
||
139 | 1 | return $this->createQueryBuilder(InsertSelectBuilder::class); |
|
140 | } |
||
141 | } |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: