Conditions | 3 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | public function realEscapeString($unescapedString, Connection $linkIdentifier = null) |
||
13 | { |
||
14 | $connection = $this->manager->getOpenConnectionOrFail($linkIdentifier); |
||
1 ignored issue
–
show
|
|||
15 | |||
16 | $escaped = $connection->quote($unescapedString); |
||
17 | // Hack! |
||
18 | if ($escaped[0] === "'" && $escaped[strlen($escaped)-1] === "'") { |
||
19 | return substr($escaped, 1, -1); |
||
20 | } |
||
21 | |||
22 | throw new \Exception("Cannot escape string"); |
||
23 | } |
||
24 | } |
||
25 |
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: