1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @copyright Copyright (c) 2018 Roeland Jago Douma <[email protected]> |
4
|
|
|
* |
5
|
|
|
* @author Roeland Jago Douma <[email protected]> |
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
|
|
|
|
24
|
|
|
namespace OCA\Files_Antivirus; |
25
|
|
|
|
26
|
|
|
use OCA\Files_Antivirus\Db\ItemMapper; |
27
|
|
|
use OCP\Activity\IManager as ActivityManager; |
28
|
|
|
use OCP\Files\File; |
29
|
|
|
use OCP\Files\IRootFolder; |
30
|
|
|
use OCP\ILogger; |
31
|
|
|
|
32
|
|
|
class ItemFactory { |
33
|
|
|
/** @var AppConfig */ |
34
|
|
|
private $config; |
35
|
|
|
|
36
|
|
|
/** @var ActivityManager */ |
37
|
|
|
private $activityManager; |
38
|
|
|
|
39
|
|
|
/** @var ItemMapper */ |
40
|
|
|
private $itemMapper; |
41
|
|
|
|
42
|
|
|
/** @var ILogger */ |
43
|
|
|
private $logger; |
44
|
|
|
|
45
|
|
|
/** @var IRootFolder */ |
46
|
|
|
private $rootFolder; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* ItemFactory constructor. |
50
|
|
|
* |
51
|
|
|
* @param AppConfig $appConfig |
52
|
|
|
* @param ActivityManager $activityManager |
53
|
|
|
* @param ItemMapper $itemMapper |
54
|
|
|
* @param ILogger $logger |
55
|
|
|
* @param IRootFolder $rootFolder |
56
|
|
|
*/ |
57
|
|
|
public function __construct(AppConfig $appConfig, |
58
|
|
|
ActivityManager $activityManager, |
59
|
|
|
ItemMapper $itemMapper, |
60
|
|
|
ILogger $logger, |
61
|
|
|
IRootFolder $rootFolder) { |
62
|
|
|
$this->config = $appConfig; |
63
|
|
|
$this->activityManager = $activityManager; |
64
|
|
|
$this->itemMapper = $itemMapper; |
65
|
|
|
$this->logger = $logger; |
66
|
|
|
$this->rootFolder = $rootFolder; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @param File $file |
71
|
|
|
* @return Item |
72
|
|
|
*/ |
73
|
|
|
public function newItem(File $file, $isCron = false) { |
74
|
|
|
return new Item( |
75
|
|
|
$this->config, |
76
|
|
|
$this->activityManager, |
77
|
|
|
$this->itemMapper, |
78
|
|
|
$this->logger, |
79
|
|
|
$this->rootFolder, |
80
|
|
|
$file, |
81
|
|
|
$isCron |
82
|
|
|
); |
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
|