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

UtilityService::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 2
cts 2
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 1
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
}