Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
usergroup
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 query
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
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
14namespace phpbb\mention\source;
15
16class usergroup extends base_group
17{
18    /**
19     * {@inheritdoc}
20     */
21    protected function query(string $keyword, int $topic_id): string
22    {
23        return $this->db->sql_build_query('SELECT', [
24            'SELECT'    => 'g.group_id',
25            'FROM'    => [
26                GROUPS_TABLE => 'g',
27            ],
28            'LEFT_JOIN' => [
29                [
30                    'FROM'    => [USER_GROUP_TABLE => 'ug'],
31                    'ON'    => 'g.group_id = ug.group_id'
32                ]
33            ],
34            'WHERE'        => 'ug.user_pending = 0 AND ug.user_id = ' . (int) $this->user->data['user_id'],
35            'ORDER_BY'    => 'g.group_name',
36        ]);
37    }
38}