Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
8 / 8 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| group | |
100.00% |
8 / 8 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| get_priority | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| query | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * |
| 4 | * This file is part of the phpBB Forum Software package. |
| 5 | * |
| 6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
| 8 | * |
| 9 | * For full copyright and license information, please see |
| 10 | * the docs/CREDITS.txt file. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | namespace phpbb\mention\source; |
| 15 | |
| 16 | class group extends base_group |
| 17 | { |
| 18 | /** @var int */ |
| 19 | protected $cache_ttl = 300; |
| 20 | |
| 21 | /** |
| 22 | * {@inheritdoc} |
| 23 | */ |
| 24 | public function get_priority(array $row): int |
| 25 | { |
| 26 | /* |
| 27 | * Presence in array with all names for this type should not increase the priority |
| 28 | * Otherwise names will not be properly sorted because we fetch them in batches |
| 29 | * and the name from 'special' source can be absent from the array with all names |
| 30 | * and therefore it will appear lower than needed |
| 31 | */ |
| 32 | return 0; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * {@inheritdoc} |
| 37 | */ |
| 38 | protected function query(string $keyword, int $topic_id): string |
| 39 | { |
| 40 | return $this->db->sql_build_query('SELECT', [ |
| 41 | 'SELECT' => 'g.group_id', |
| 42 | 'FROM' => [ |
| 43 | GROUPS_TABLE => 'g', |
| 44 | ], |
| 45 | 'ORDER_BY' => 'g.group_name', |
| 46 | ]); |
| 47 | } |
| 48 | } |