Completed
Pull Request — master (#1416)
by Christoph
13:19
created

Application   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 93.75%

Importance

Changes 4
Bugs 2 Features 1
Metric Value
wmc 2
c 4
b 2
f 1
lcom 0
cbo 0
dl 0
loc 30
ccs 15
cts 16
cp 0.9375
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 20 2
1
<?php
2
3
/**
4
 * @author Christoph Wurst <[email protected]>
5
 * @author Thomas Müller <[email protected]>
6
 *
7
 * ownCloud - Mail
8
 *
9
 * This code is free software: you can redistribute it and/or modify
10
 * it under the terms of the GNU Affero General Public License, version 3,
11
 * as published by the Free Software Foundation.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
 * GNU Affero General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Affero General Public License, version 3,
19
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
20
 *
21
 */
22
23
namespace OCA\Mail\AppInfo;
24
25
use \OCP\AppFramework\App;
26
27
class Application extends App {
28
29
	public static $ispUrls = [
30
	    'https://autoconfig.{DOMAIN}/mail/config-v1.1.xml',
31
	    'https://{DOMAIN}/.well-known/autoconfig/mail/config-v1.1.xml',
32
	    'https://autoconfig.thunderbird.net/v1.1/{DOMAIN}',
33
	];
34
35 1
	public function __construct(array $urlParams = []) {
36 1
		parent::__construct('mail', $urlParams);
37
38 1
		$container = $this->getContainer();
39
40 1
		$transport = $container->getServer()->getConfig()->getSystemValue('app.mail.transport', 'smtp');
41 1
		$testSmtp = $transport === 'smtp';
42
43 1
		$container->registerService('OCP\ISession', function ($c) {
44
			return $c->getServer()->getSession();
45 1
		});
46
47 1
		$user = $container->query("UserId");
48 1
		$container->registerParameter("appName", "mail");
49 1
		$container->registerParameter("userFolder", $container->getServer()->getUserFolder($user));
50 1
		$container->registerParameter("testSmtp", $testSmtp);
51 1
		$container->registerParameter("referrer", isset($_SERVER['HTTP_REFERER']) ? : null);
52 1
		$container->registerParameter("hostname", \OCP\Util::getServerHostName());
53 1
		$container->registerParameter('ispUrls', self::$ispUrls);
54 1
	}
55
56
}
57