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

Application::__construct()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 19
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 2.0011

Importance

Changes 4
Bugs 1 Features 0
Metric Value
c 4
b 1
f 0
dl 0
loc 19
ccs 14
cts 15
cp 0.9333
rs 9.4285
cc 2
eloc 13
nc 1
nop 1
crap 2.0011
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