Personal::getPriority()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Audio Player
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the LICENSE.md file.
7
 *
8
 * @author Marcel Scherello <[email protected]>
9
 * @copyright 2016-2021 Marcel Scherello
10
 */
11
12
namespace OCA\audioplayer\Settings;
13
14
use OCP\AppFramework\Http\TemplateResponse;
15
use OCP\Settings\ISettings;
16
use OCP\IConfig;
17
18
class Personal implements ISettings
19
{
20
21
    private $userId;
22
    private $configManager;
23
24
    public function __construct(
25
        $userId,
26
        IConfig $configManager
27
    )
28
    {
29
        $this->userId = $userId;
30
        $this->configManager = $configManager;
31
    }
32
33
    /**
34
     * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
35
     * @since 9.1
36
     */
37
    public function getForm()
38
    {
39
40
        $parameters = [
41
            'audioplayer_cyrillic' => $this->configManager->getUserValue($this->userId, 'audioplayer', 'cyrillic'),
42
            'audioplayer_path' => $this->configManager->getUserValue($this->userId, 'audioplayer', 'path'),
43
        ];
44
        return new TemplateResponse('audioplayer', 'settings/personal', $parameters, '');
45
    }
46
47
    /**
48
     * Print config section (ownCloud 10)
49
     *
50
     * @return TemplateResponse
51
     */
52
    public function getPanel()
53
    {
54
        return $this->getForm();
55
    }
56
57
    /**
58
     * @return string the section ID, e.g. 'sharing'
59
     * @since 9.1
60
     */
61
    public function getSection()
62
    {
63
        return 'audioplayer';
64
    }
65
66
    /**
67
     * Get section ID (ownCloud 10)
68
     *
69
     * @return string
70
     */
71
    public function getSectionID()
72
    {
73
        return 'audioplayer';
74
    }
75
76
    /**
77
     * @return int whether the form should be rather on the top or bottom of
78
     * the admin section. The forms are arranged in ascending order of the
79
     * priority values. It is required to return a value between 0 and 100.
80
     *
81
     * E.g.: 70
82
     * @since 9.1
83
     */
84
    public function getPriority()
85
    {
86
        return 10;
87
    }
88
}
89