Completed
Push — master ( cb9863...be434f )
by
unknown
40:07 queued 25:06
created

RecordRememberer::rememberRecords()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the TYPO3 CMS project.
7
 *
8
 * It is free software; you can redistribute it and/or modify it under
9
 * the terms of the GNU General Public License, either version 2
10
 * of the License, or any later version.
11
 *
12
 * For the full copyright and license information, please read the
13
 * LICENSE.txt file that was distributed with this source code.
14
 *
15
 * The TYPO3 project - inspiring people to share!
16
 */
17
18
namespace TYPO3\CMS\Backend\View\BackendLayout;
19
20
use TYPO3\CMS\Core\SingletonInterface;
21
22
class RecordRememberer implements SingletonInterface
23
{
24
    /**
25
     * @var int[]
26
     */
27
    protected $rememberedUids = [];
28
29
    public function rememberRecords(iterable $records): void
30
    {
31
        foreach ($records as $record) {
32
            $this->rememberRecordUid($record['uid'] ?? 0);
33
            $this->rememberRecordUid($record['l18n_parent'] ?? 0);
34
        }
35
    }
36
37
    public function rememberRecordUid(int $uid): void
38
    {
39
        $this->rememberedUids[$uid] = $uid;
40
    }
41
42
    public function isRemembered(int $uid): bool
43
    {
44
        return isset($this->rememberedUids[$uid]);
45
    }
46
}
47