Completed
Push — master ( 59ae2c...edeca8 )
by Christoph
15s
created

Application   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 93.33%

Importance

Changes 4
Bugs 1 Features 0
Metric Value
wmc 2
c 4
b 1
f 0
lcom 0
cbo 0
dl 0
loc 23
ccs 14
cts 15
cp 0.9333
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 19 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
use OCP\Util;
27
28
class Application extends App {
29
30 1
	public function __construct(array $urlParams = []) {
31 1
		parent::__construct('mail', $urlParams);
32
33 1
		$container = $this->getContainer();
34
35 1
		$transport = $container->getServer()->getConfig()->getSystemValue('app.mail.transport', 'smtp');
36 1
		$testSmtp = $transport === 'smtp';
37
38 1
		$container->registerService('OCP\ISession', function ($c) {
39
			return $c->getServer()->getSession();
40 1
		});
41
42 1
		$user = $container->query("UserId");
43 1
		$container->registerParameter("appName", "mail");
44 1
		$container->registerParameter("userFolder", $container->getServer()->getUserFolder($user));
45 1
		$container->registerParameter("testSmtp", $testSmtp);
46 1
		$container->registerParameter("referrer", isset($_SERVER['HTTP_REFERER']) ? : null);
47 1
		$container->registerParameter("hostname", Util::getServerHostName());
48 1
	}
49
50
}
51