Passed
Push — master ( 51add7...7917f4 )
by Julius
13:12 queued 12s
created

Defaults::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @copyright Copyright (c) 2016, ownCloud, Inc.
7
 *
8
 * @author Björn Schießle <[email protected]>
9
 * @author J0WI <[email protected]>
10
 * @author Joas Schilling <[email protected]>
11
 * @author Julius Härtl <[email protected]>
12
 * @author Lukas Reschke <[email protected]>
13
 * @author Morris Jobke <[email protected]>
14
 * @author Roeland Jago Douma <[email protected]>
15
 * @author scolebrook <[email protected]>
16
 *
17
 * @license AGPL-3.0
18
 *
19
 * This code is free software: you can redistribute it and/or modify
20
 * it under the terms of the GNU Affero General Public License, version 3,
21
 * as published by the Free Software Foundation.
22
 *
23
 * This program is distributed in the hope that it will be useful,
24
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
 * GNU Affero General Public License for more details.
27
 *
28
 * You should have received a copy of the GNU Affero General Public License, version 3,
29
 * along with this program. If not, see <http://www.gnu.org/licenses/>
30
 *
31
 */
32
// use OCP namespace for all classes that are considered public.
33
// This means that they should be used by apps instead of the internal ownCloud classes
34
35
namespace OCP;
36
37
/**
38
 * public api to access default strings and urls for your templates
39
 * @since 6.0.0
40
 */
41
class Defaults {
42
43
	/**
44
	 * \OC_Defaults instance to retrieve the defaults
45
	 * @since 6.0.0
46
	 */
47
	private $defaults;
48
49
	/**
50
	 * creates a \OC_Defaults instance which is used in all methods to retrieve the
51
	 * actual defaults
52
	 * @since 6.0.0
53
	 */
54
	public function __construct(\OC_Defaults $defaults = null) {
55
		if ($defaults === null) {
56
			$defaults = \OC::$server->getThemingDefaults();
57
		}
58
		$this->defaults = $defaults;
59
	}
60
61
	/**
62
	 * get base URL for the organisation behind your ownCloud instance
63
	 * @return string
64
	 * @since 6.0.0
65
	 */
66
	public function getBaseUrl(): string {
67
		return $this->defaults->getBaseUrl();
68
	}
69
70
	/**
71
	 * link to the desktop sync client
72
	 * @return string
73
	 * @since 6.0.0
74
	 */
75
	public function getSyncClientUrl(): string {
76
		return $this->defaults->getSyncClientUrl();
77
	}
78
79
	/**
80
	 * link to the iOS client
81
	 * @return string
82
	 * @since 8.0.0
83
	 */
84
	public function getiOSClientUrl(): string {
85
		return $this->defaults->getiOSClientUrl();
86
	}
87
88
	/**
89
	 * link to the Android client
90
	 * @return string
91
	 * @since 8.0.0
92
	 */
93
	public function getAndroidClientUrl(): string {
94
		return $this->defaults->getAndroidClientUrl();
95
	}
96
97
	/**
98
	 * base URL to the documentation of your ownCloud instance
99
	 * @return string
100
	 * @since 6.0.0
101
	 */
102
	public function getDocBaseUrl(): string {
103
		return $this->defaults->getDocBaseUrl();
104
	}
105
106
	/**
107
	 * name of your Nextcloud instance (e.g. MyPrivateCloud)
108
	 * @return string
109
	 * @since 6.0.0
110
	 */
111
	public function getName(): string {
112
		return $this->defaults->getName();
113
	}
114
115
	/**
116
	 * Name of the software product (defaults to Nextcloud)
117
	 *
118
	 * @return string
119
	 * @since 22.0.0
120
	 */
121
	public function getProductName(): string {
122
		return $this->defaults->getProductName();
0 ignored issues
show
introduced by
The method getProductName() does not exist on OC_Defaults. Maybe you want to declare this class abstract? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

122
		return $this->defaults->/** @scrutinizer ignore-call */ getProductName();
Loading history...
123
	}
124
125
	/**
126
	 * name of your ownCloud instance containing HTML styles
127
	 * @return string
128
	 * @since 8.0.0
129
	 * @depreacted 22.0.0
130
	 */
131
	public function getHTMLName(): string {
132
		return $this->defaults->getHTMLName();
133
	}
134
135
	/**
136
	 * Entity behind your onwCloud instance
137
	 * @return string
138
	 * @since 6.0.0
139
	 */
140
	public function getEntity(): string {
141
		return $this->defaults->getEntity();
142
	}
143
144
	/**
145
	 * ownCloud slogan
146
	 * @return string
147
	 * @since 6.0.0
148
	 */
149
	public function getSlogan(?string $lang = null): string {
150
		return $this->defaults->getSlogan($lang);
151
	}
152
153
	/**
154
	 * footer, short version
155
	 * @return string
156
	 * @since 6.0.0
157
	 */
158
	public function getShortFooter(): string {
159
		return $this->defaults->getShortFooter();
160
	}
161
162
	/**
163
	 * footer, long version
164
	 * @return string
165
	 * @since 6.0.0
166
	 */
167
	public function getLongFooter(): string {
168
		return $this->defaults->getLongFooter();
169
	}
170
171
	/**
172
	 * Returns the AppId for the App Store for the iOS Client
173
	 * @return string AppId
174
	 * @since 8.0.0
175
	 */
176
	public function getiTunesAppId(): string {
177
		return $this->defaults->getiTunesAppId();
178
	}
179
180
	/**
181
	 * Themed logo url
182
	 *
183
	 * @param bool $useSvg Whether to point to the SVG image or a fallback
184
	 * @return string
185
	 * @since 12.0.0
186
	 */
187
	public function getLogo(bool $useSvg = true): string {
188
		return $this->defaults->getLogo($useSvg);
189
	}
190
191
	/**
192
	 * Returns primary color
193
	 * @return string
194
	 * @since 12.0.0
195
	 */
196
	public function getColorPrimary(): string {
197
		return $this->defaults->getColorPrimary();
198
	}
199
200
	/**
201
	 * @param string $key
202
	 * @return string URL to doc with key
203
	 * @since 12.0.0
204
	 */
205
	public function buildDocLinkToKey(string $key): string {
206
		return $this->defaults->buildDocLinkToKey($key);
207
	}
208
209
	/**
210
	 * Returns the title
211
	 * @return string title
212
	 * @since 12.0.0
213
	 */
214
	public function getTitle(): string {
215
		return $this->defaults->getTitle();
216
	}
217
218
	/**
219
	 * Returns primary color
220
	 * @return string
221
	 * @since 13.0.0
222
	 */
223
	public function getTextColorPrimary(): string {
224
		return $this->defaults->getTextColorPrimary();
225
	}
226
}
227