Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
25 | public function convertRequest(): QueryBuilder |
||
26 | { |
||
27 | /** @var QueryBuilder $qb */ |
||
28 | $qb = $this->qb; |
||
|
|||
29 | $phrase = $this->request->query->all('phrase', null); |
||
30 | |||
31 | $alias = current($qb->getRootAliases()); |
||
32 | if (isset($phrase['phrase'])) { |
||
33 | $qb->add('where', |
||
34 | $qb->expr()->like($alias.'.name', $qb->expr()->literal('%' . $phrase['phrase'] . '%')) |
||
35 | ); |
||
36 | } |
||
37 | |||
38 | return $qb; |
||
39 | } |
||
40 | } |
||
41 |
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: