Completed
Push — development ( 6e663f...7f669c )
by Torben
04:00
created

UtilityService   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 43
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A clearCacheForConfiguredUids() 0 7 2
1
<?php
2
namespace DERHANSEN\SfEventMgt\Service;
3
4
/*
5
 * This file is part of the TYPO3 CMS project.
6
 *
7
 * It is free software; you can redistribute it and/or modify it under
8
 * the terms of the GNU General Public License, either version 2
9
 * of the License, or any later version.
10
 *
11
 * For the full copyright and license information, please read the
12
 * LICENSE.txt file that was distributed with this source code.
13
 *
14
 * The TYPO3 project - inspiring people to share!
15
 */
16
17
use TYPO3\CMS\Extbase\Service\CacheService;
18
19
/**
20
 * UtilityService
21
 *
22
 * @author Torben Hansen <[email protected]>
23
 */
24
class UtilityService
25
{
26
27
    /**
28
     * CacheService
29
     *
30
     * @var \TYPO3\CMS\Extbase\Service\CacheService
31
     */
32
    protected $cacheService;
33
34
    /**
35
     * Settings Service
36
     *
37
     * @var \DERHANSEN\SfEventMgt\Service\SettingsService
38
     */
39
    protected $settingsService;
40
41
    /**
42
     * UtilityService constructor.
43
     * @param CacheService $cacheService
44
     * @param SettingsService $settingsService
45
     */
46
    public function __construct(CacheService $cacheService, SettingsService $settingsService)
47
    {
48 2
        $this->cacheService = $cacheService;
49
        $this->settingsService = $settingsService;
50 2
    }
51 2
52 1
    /**
53 1
     * Clears the cache of configured pages in TypoScript
54 2
     *
55
     * @param array $settings The settings
56
     *
57
     * @return void
58
     */
59
    public function clearCacheForConfiguredUids($settings)
60
    {
61
        $pidList = $this->settingsService->getClearCacheUids($settings);
62
        if (count($pidList) > 0) {
63
            $this->cacheService->clearPageCache($pidList);
64
        }
65
    }
66
}