Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
PermissionHelper
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
1 / 1
 permOptions
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
3
1<?php
2
3/**
4 * This class is a helper class for permission relevant methods.
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public License,
7 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
8 * obtain one at https://mozilla.org/MPL/2.0/.
9 *
10 * @package   phpMyFAQ
11 * @author    Thorsten Rinne <thorsten@phpmyfaq.de>
12 * @copyright 2018-2026 phpMyFAQ Team
13 * @license   https://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
14 * @link      https://www.phpmyfaq.de
15 * @since     2018-07-18
16 */
17
18declare(strict_types=1);
19
20namespace phpMyFAQ\Helper;
21
22/**
23 * Class PermissionHelper
24 *
25 * @package phpMyFAQ\Helper
26 */
27class PermissionHelper
28{
29    /**
30     * Renders a select box for permission types.
31     *
32     * @param  string $current Selected option
33     */
34    public static function permOptions(string $current): string
35    {
36        $options = ['basic', 'medium'];
37        $output = '';
38
39        foreach ($options as $option) {
40            $output .= sprintf(
41                '<option value="%s" %s>%s</option>',
42                $option,
43                $option === $current ? 'selected' : '',
44                $option,
45            );
46        }
47
48        return $output;
49    }
50}