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