11<?php
22
33declare (strict_types=1 );
4- /**
5- * @copyright Copyright (c) 2022 Solution Libre SAS
6- * @copyright Copyright (c) 2020 Robin Appelman <robin@icewind.nl>
7- *
8- * @author Florent Poinsaut <florent@solution-libre.fr>
9- * @author Robin Appelman <robin@icewind.nl>
10- *
11- * @license GNU AGPL version 3 or any later version
12- *
13- * This program is free software: you can redistribute it and/or modify
14- * it under the terms of the GNU Affero General Public License as
15- * published by the Free Software Foundation, either version 3 of the
16- * License, or (at your option) any later version.
17- *
18- * This program is distributed in the hope that it will be useful,
19- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21- * GNU Affero General Public License for more details.
22- *
23- * You should have received a copy of the GNU Affero General Public License
24- * along with this program. If not, see <http://www.gnu.org/licenses/>.
25- *
26- */
4+
5+ // SPDX-FileCopyrightText: 2020 Robin Appelman <robin@icewind.nl>
6+ // SPDX-FileCopyrightText: 2022 Solution Libre SAS
7+ // SPDX-License-Identifier: AGPL-3.0-or-later
278
289namespace OCA \ShareListing \Service ;
2910
5435class ReportSender {
5536 protected const REPORT_NAME = ' - Shares report. ' ;
5637
57- /** @var string */
58- private $ appName ;
59- /** @var Iconfig */
60- private $ config ;
61- /** @var ?array */
62- protected $ diffReport = null ;
63-
64- private $ mailer ;
65- private $ userManager ;
66- private $ defaults ;
67- private $ l10nFactory ;
68- private $ logger ;
69-
70- /** @var array */
71- protected $ reports = [];
72- /** @var SharesList */
73- private $ sharesList ;
74- /** @var IRootFolder */
75- private $ root ;
76- /** @var IURLGenerator */
77- protected $ url ;
38+ protected ?array $ diffReport = null ;
39+ protected array $ reports = [];
7840
7941 public function __construct (
80- string $ appName ,
81- IConfig $ config ,
82- IMailer $ mailer ,
83- IUserManager $ userManager ,
84- Defaults $ defaults ,
85- IFactory $ l10nFactory ,
86- LoggerInterface $ logger ,
87- SharesList $ sharesList ,
88- IRootFolder $ root ,
89- IURLGenerator $ url ,
42+ private readonly string $ appName ,
43+ private readonly IConfig $ config ,
44+ private readonly IMailer $ mailer ,
45+ private readonly IUserManager $ userManager ,
46+ private readonly Defaults $ defaults ,
47+ private readonly IFactory $ l10nFactory ,
48+ private readonly LoggerInterface $ logger ,
49+ private readonly SharesList $ sharesList ,
50+ private readonly IRootFolder $ root ,
51+ private readonly IURLGenerator $ url ,
9052 ) {
91- $ this ->appName = $ appName ;
92- $ this ->config = $ config ;
93- $ this ->mailer = $ mailer ;
94- $ this ->userManager = $ userManager ;
95- $ this ->defaults = $ defaults ;
96- $ this ->l10nFactory = $ l10nFactory ;
97- $ this ->logger = $ logger ;
98- $ this ->sharesList = $ sharesList ;
99- $ this ->root = $ root ;
100- $ this ->url = $ url ;
10153 }
10254
10355 public function createReport (
@@ -108,7 +60,7 @@ public function createReport(
10860 int $ filter = SharesList::FILTER_NONE ,
10961 ?string $ path = null ,
11062 ?string $ token = null ,
111- ) {
63+ ): void {
11264 $ userFolder = $ this ->root ->getUserFolder ($ recipient );
11365
11466 if ($ userFolder ->nodeExists ($ targetPath )) {
@@ -146,7 +98,7 @@ public function createReport(
14698 }
14799 }
148100
149- public function sendReport (string $ recipient , \DateTimeImmutable $ dateTime ) {
101+ public function sendReport (string $ recipient , \DateTimeImmutable $ dateTime ): void {
150102 $ defaultLanguage = $ this ->config ->getSystemValue ('default_language ' , 'en ' );
151103 $ userLanguages = $ this ->config ->getUserValue ($ recipient , 'core ' , 'lang ' );
152104 $ language = (!empty ($ userLanguages )) ? $ userLanguages : $ defaultLanguage ;
@@ -199,7 +151,6 @@ public function sendReport(string $recipient, \DateTimeImmutable $dateTime) {
199151 $ this ->mailer ->send ($ message );
200152 } catch (\Exception $ e ) {
201153 $ this ->logger ->error ($ e ->getMessage ());
202- return ;
203154 }
204155 }
205156
@@ -228,7 +179,7 @@ protected function getEmailAdressFromUserId(string $userId): ?string {
228179 public function diff (
229180 string $ userId ,
230181 string $ dir ,
231- ) {
182+ ): void {
232183 $ userFolder = $ this ->root ->getUserFolder ($ userId );
233184
234185 if ($ userFolder ->nodeExists ($ dir )) {
0 commit comments