Updater::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 3
1
<?php
2
/**
3
 * ownCloud - News
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Alessandro Cosentino <[email protected]>
9
 * @author Bernhard Posselt <[email protected]>
10
 * @copyright Alessandro Cosentino 2012
11
 * @copyright Bernhard Posselt 2012, 2014
12
 */
13
14
15
namespace OCA\News\Utility;
16
17
use \OCA\News\Service\FolderService;
18
use \OCA\News\Service\FeedService;
19
use \OCA\News\Service\ItemService;
20
21
22
class Updater {
23
24
25
    private $folderService;
26
    private $feedService;
27
    private $itemService;
28
29
    public function __construct(FolderService $folderService,
30
                                FeedService $feedService,
31
                                ItemService $itemService) {
32
        $this->folderService = $folderService;
33
        $this->feedService = $feedService;
34
        $this->itemService = $itemService;
35
    }
36
37
38
    public function beforeUpdate() {
39
        $this->folderService->purgeDeleted();
40
        $this->feedService->purgeDeleted();
41
    }
42
43
44
    public function update() {
45
        $this->feedService->updateAll();
46
    }
47
48
49
    public function afterUpdate() {
50
        $this->itemService->autoPurgeOld();
51
    }
52
53
54
}