Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 7
CRAP
0.00% covered (danger)
0.00%
0 / 1
CospendWidget
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 7
56
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getId
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getTitle
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getOrder
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getIconClass
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getUrl
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 load
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * @copyright Copyright (c) 2020 Julien Veyssier <eneiluj@posteo.net>
4 *
5 * @author Julien Veyssier <eneiluj@posteo.net>
6 *
7 * @license GNU AGPL version 3 or any later version
8 *
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as
11 * published by the Free Software Foundation, either version 3 of the
12 * License, or (at your option) any later version.
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
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 *
22 */
23
24namespace OCA\Cospend\Dashboard;
25
26use OCP\Dashboard\IWidget;
27use OCP\IL10N;
28use OCP\IURLGenerator;
29
30use OCA\Cospend\AppInfo\Application;
31use OCP\Util;
32
33class CospendWidget implements IWidget {
34
35    /** @var IL10N */
36    private $l10n;
37    /**
38     * @var IURLGenerator
39     */
40    private $url;
41
42    public function __construct(IL10N $l10n,
43                                IURLGenerator $url) {
44        $this->l10n = $l10n;
45        $this->url = $url;
46    }
47
48    /**
49     * @inheritDoc
50     */
51    public function getId(): string {
52        return 'cospend_activity';
53    }
54
55    /**
56     * @inheritDoc
57     */
58    public function getTitle(): string {
59        return $this->l10n->t('Cospend activity');
60    }
61
62    /**
63     * @inheritDoc
64     */
65    public function getOrder(): int {
66        return 10;
67    }
68
69    /**
70     * @inheritDoc
71     */
72    public function getIconClass(): string {
73        return 'icon-cospend';
74    }
75
76    /**
77     * @inheritDoc
78     */
79    public function getUrl(): ?string {
80        return $this->url->linkToRoute('cospend.page.index', []);
81    }
82
83    /**
84     * @inheritDoc
85     */
86    public function load(): void {
87        Util::addScript(Application::APP_ID, Application::APP_ID . '-dashboard');
88        Util::addStyle(Application::APP_ID, 'dashboard');
89    }
90}