Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Setting.js « Setting « Model « src - git.mdns.eu/nextcloud/passwords-client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3a73bdb79d11ca74d587addfecdbc61e6993f3c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
import InvalidScopeError from '../../Exception/InvalidScopeError';

export default class Setting {

    /**
     * @return {String}
     */
    get SCOPE_USER() {
        return 'user';
    }

    /**
     * @return {String}
     */
    get SCOPE_SERVER() {
        return 'server';
    }

    /**
     * @return {String}
     */
    get SCOPE_CLIENT() {
        return 'client';
    }

    /**
     * @return {String[]}
     */
    get SCOPES() {
        return [
            this.SCOPE_USER,
            this.SCOPE_SERVER,
            this.SCOPE_CLIENT
        ];
    }

    /**
     * @return {String}
     */
    get name() {
        return this._name;
    }

    /**
     * @param {String} value
     */
    set name(value) {
        this._name = value;
    }

    /**
     * @return {String}
     */
    get value() {
        return this._value;
    }

    /**
     * @param {String} value
     */
    set value(value) {
        this._value = value;
    }

    /**
     * @return {String}
     */
    get scope() {
        return this._scope;
    }

    /**
     * @param {String} value
     */
    set scope(value) {
        if(this.SCOPES.indexOf(value) === -1) {
            throw new InvalidScopeError(value);
        }

        this._scope = value;
    }

    /**
     * @param {String} name
     * @param {String} value
     * @param {String} scope
     */
    constructor(name, value, scope = 'client') {
        if(this.SCOPES.indexOf(scope) === -1) {
            throw new InvalidScopeError(scope);
        }

        this._name = name;
        this._value = value;
        this._scope = scope;
    }

    /**
     * @return {String}
     */
    getName() {
        return this._name;
    }

    /**
     * @param {String} value
     *
     * @return {Setting}
     */
    setName(value) {
        this.name = value;

        return this;
    }

    /**
     * @return {String}
     */
    getValue() {
        return this._value;
    }

    /**
     * @param {String} value
     *
     * @return {Setting}
     */
    setValue(value) {
        this.value = value;

        return this;
    }

    /**
     * @return {String}
     */
    getScope() {
        return this._scope;
    }

    /**
     * @param {String} value
     *
     * @return {Setting}
     */
    setScope(value) {
        this.scope = value;

        return this;
    }
}