Personal   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Importance

Changes 4
Bugs 1 Features 0
Metric Value
eloc 13
c 4
b 1
f 0
dl 0
loc 69
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getPriority() 0 3 1
A getForm() 0 8 1
A getSectionID() 0 3 1
A getPanel() 0 3 1
A __construct() 0 7 1
A getSection() 0 3 1
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-2019 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