1<?php
2/**
3 * @author Roeland Jago Douma <rullzer@owncloud.com>
4 * @author Thomas Müller <thomas.mueller@tmit.eu>
5 * @author Viktar Dubiniuk <dubiniuk@owncloud.com>
6 *
7 * @copyright Copyright (c) 2018, ownCloud GmbH
8 * @license AGPL-3.0
9 *
10 * This code is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Affero General Public License, version 3,
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
18 *
19 * You should have received a copy of the GNU Affero General Public License, version 3,
20 * along with this program.  If not, see <http://www.gnu.org/licenses/>
21 *
22 */
23
24namespace OCA\Files_Versions\AppInfo;
25
26use OCA\Files_Versions\Expiration;
27use OCA\Files_Versions\FileHelper;
28use OCP\AppFramework\App;
29
30class Application extends App {
31	public function __construct(array $urlParams = []) {
32		parent::__construct('files_versions', $urlParams);
33
34		$container = $this->getContainer();
35
36		/*
37		 * Register capabilities
38		 */
39		$container->registerCapability('OCA\Files_Versions\Capabilities');
40
41		/*
42		 * Register expiration
43		 */
44		$container->registerService('Expiration', function ($c) {
45			return new Expiration(
46				$c->query('ServerContainer')->getConfig(),
47				$c->query('OCP\AppFramework\Utility\ITimeFactory')
48			);
49		});
50
51		/*
52		 * Register FileHelper
53		 */
54		$container->registerService(
55			'FileHelper',
56			function ($c) {
57				return new FileHelper();
58			}
59		);
60	}
61}
62