ForeignRecordDemand::getStoragePage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
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 Extension "sf_event_mgt" for TYPO3 CMS.
7
 *
8
 * For the full copyright and license information, please read the
9
 * LICENSE.txt file that was distributed with this source code.
10
 */
11
12
namespace DERHANSEN\SfEventMgt\Domain\Model\Dto;
13
14
use TYPO3\CMS\Core\Utility\GeneralUtility;
15
16
class ForeignRecordDemand
17
{
18
    protected string $storagePage = '';
19
    protected bool $restrictForeignRecordsToStoragePage = false;
20
21
    public function getStoragePage(): string
22
    {
23
        return $this->storagePage;
24
    }
25
26
    public function setStoragePage(string $storagePage): void
27
    {
28
        $this->storagePage = $storagePage;
29
    }
30
31
    public function getRestrictForeignRecordsToStoragePage(): bool
32
    {
33
        return $this->restrictForeignRecordsToStoragePage;
34
    }
35
36
    public function setRestrictForeignRecordsToStoragePage(bool $restrictForeignRecordsToStoragePage): void
37
    {
38
        $this->restrictForeignRecordsToStoragePage = $restrictForeignRecordsToStoragePage;
39
    }
40
41
    /**
42
     * Creates a new ForeignRecordDemand object from the given settings.
43
     *
44
     * @param array $settings
45
     * @return ForeignRecordDemand
46
     */
47
    public static function createFromSettings(array $settings = []): self
48
    {
49
        $demand = GeneralUtility::makeInstance(ForeignRecordDemand::class);
50
        $demand->setStoragePage((string)($settings['storagePage'] ?? ''));
51
        $demand->setRestrictForeignRecordsToStoragePage(
52
            (bool)($settings['restrictForeignRecordsToStoragePage'] ?? false)
53
        );
54
55
        return $demand;
56
    }
57
}
58