|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace AOE\Crawler\Value; |
|
6
|
|
|
|
|
7
|
|
|
/* |
|
8
|
|
|
* (c) 2020 AOE GmbH <[email protected]> |
|
9
|
|
|
* |
|
10
|
|
|
* This file is part of the TYPO3 Crawler Extension. |
|
11
|
|
|
* |
|
12
|
|
|
* It is free software; you can redistribute it and/or modify it under |
|
13
|
|
|
* the terms of the GNU General Public License, either version 2 |
|
14
|
|
|
* of the License, or any later version. |
|
15
|
|
|
* |
|
16
|
|
|
* For the full copyright and license information, please read the |
|
17
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
18
|
|
|
* |
|
19
|
|
|
* The TYPO3 project - inspiring people to share! |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
final class ModuleSettings |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* @var string |
|
26
|
|
|
*/ |
|
27
|
|
|
private $crawlAction; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @var int |
|
31
|
|
|
*/ |
|
32
|
|
|
private $pages; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @var int |
|
36
|
|
|
*/ |
|
37
|
|
|
private $depth; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @var int |
|
41
|
|
|
*/ |
|
42
|
|
|
private $itemsPerPage; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @var string |
|
46
|
|
|
*/ |
|
47
|
|
|
private $logDisplay; |
|
48
|
|
|
|
|
49
|
|
|
public function __construct( |
|
50
|
|
|
string $crawlAction = 'start', |
|
51
|
|
|
int $pages = 0, |
|
52
|
|
|
int $depth = 0, |
|
53
|
|
|
int $itemsPerPage = 5, |
|
54
|
|
|
string $logDisplay = 'all' |
|
55
|
|
|
) { |
|
56
|
|
|
$this->crawlAction = $crawlAction; |
|
57
|
|
|
$this->pages = $pages; |
|
58
|
|
|
$this->depth = $depth; |
|
59
|
1 |
|
$this->itemsPerPage = $itemsPerPage; |
|
60
|
|
|
$this->logDisplay = $logDisplay; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public static function fromArray(array $array): self |
|
64
|
|
|
{ |
|
65
|
|
|
return new self( |
|
66
|
|
|
(string) $array['crawlaction'], |
|
67
|
|
|
(int) $array['pages'], |
|
68
|
1 |
|
(int) $array['depth'], |
|
69
|
1 |
|
(int) $array['itemPerPage'], |
|
70
|
1 |
|
(string) $array['log_display'] |
|
71
|
1 |
|
); |
|
72
|
1 |
|
} |
|
73
|
1 |
|
|
|
74
|
1 |
|
/** |
|
75
|
1 |
|
* @return string |
|
76
|
|
|
*/ |
|
77
|
1 |
|
public function getCrawlAction(): string |
|
78
|
|
|
{ |
|
79
|
1 |
|
return $this->crawlAction; |
|
80
|
1 |
|
} |
|
81
|
1 |
|
|
|
82
|
1 |
|
/** |
|
83
|
1 |
|
* @return int |
|
84
|
1 |
|
*/ |
|
85
|
1 |
|
public function getPages(): int |
|
86
|
1 |
|
{ |
|
87
|
|
|
return $this->pages; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
1 |
|
/** |
|
91
|
|
|
* @return int |
|
92
|
1 |
|
*/ |
|
93
|
|
|
public function getDepth(): int |
|
94
|
|
|
{ |
|
95
|
1 |
|
return $this->depth; |
|
96
|
|
|
} |
|
97
|
1 |
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @return int |
|
100
|
1 |
|
*/ |
|
101
|
|
|
public function getItemsPerPage(): int |
|
102
|
1 |
|
{ |
|
103
|
|
|
return $this->itemsPerPage; |
|
104
|
|
|
} |
|
105
|
1 |
|
|
|
106
|
|
|
/** |
|
107
|
1 |
|
* @return string |
|
108
|
|
|
*/ |
|
109
|
|
|
public function getLogDisplay(): string |
|
110
|
1 |
|
{ |
|
111
|
|
|
return $this->logDisplay; |
|
112
|
1 |
|
} |
|
113
|
|
|
} |
|
114
|
|
|
|