| Conditions | 5 |
| Paths | 8 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 36 | public function search($query, $field="title") { |
||
| 37 | $result=array (); |
||
| 38 | foreach ( $this->elements as $element ) { |
||
| 39 | if (\array_key_exists($field, $element)) { |
||
| 40 | $value=$element[$field]; |
||
| 41 | if (\stripos($value, $query) !== false) { |
||
| 42 | $result[]=$element; |
||
| 43 | } |
||
| 44 | } |
||
| 45 | } |
||
| 46 | if (\sizeof($result) > 0) { |
||
| 47 | return $result; |
||
| 48 | } |
||
| 49 | return false; |
||
| 50 | } |
||
| 51 | |||
| 64 | } |