‪TYPO3CMS  9.5
FileSearchDemand.php
Go to the documentation of this file.
1 <?php
2 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 
19 
24 {
28  private ‪$searchTerm;
29 
33  private ‪$folder;
34 
38  private ‪$firstResult;
39 
43  private ‪$maxResults;
44 
48  private ‪$searchFields;
49 
53  private ‪$orderings;
54 
58  private ‪$recursive = false;
59 
65  private function ‪__construct(string ‪$searchTerm = null)
66  {
67  $this->searchTerm = ‪$searchTerm;
68  }
69 
70  public static function ‪create(): self
71  {
72  return new self();
73  }
74 
75  public static function ‪createForSearchTerm(string ‪$searchTerm): self
76  {
77  return new self(‪$searchTerm);
78  }
79 
80  public function ‪getSearchTerm(): ?string
81  {
82  return ‪$this->searchTerm;
83  }
84 
85  public function ‪getFolder(): ?‪Folder
86  {
87  return ‪$this->folder;
88  }
89 
90  public function ‪getFirstResult(): ?int
91  {
92  return ‪$this->firstResult;
93  }
94 
95  public function ‪getMaxResults(): ?int
96  {
97  return ‪$this->maxResults;
98  }
99 
100  public function ‪getSearchFields(): ?array
101  {
102  return ‪$this->searchFields;
103  }
104 
105  public function ‪getOrderings(): ?array
106  {
107  return ‪$this->orderings;
108  }
109 
110  public function ‪isRecursive(): bool
111  {
112  return ‪$this->recursive;
113  }
114 
115  public function ‪withSearchTerm(string ‪$searchTerm): self
116  {
117  $demand = clone $this;
118  $demand->searchTerm = ‪$searchTerm;
119 
120  return $demand;
121  }
122 
123  public function ‪withFolder(‪Folder ‪$folder): self
124  {
125  $demand = clone $this;
126  $demand->folder = ‪$folder;
127 
128  return $demand;
129  }
130 
138  public function ‪withStartResult(int ‪$firstResult): self
139  {
140  $demand = clone $this;
141  $demand->firstResult = ‪$firstResult;
142 
143  return $demand;
144  }
145 
146  public function ‪withMaxResults(int ‪$maxResults): self
147  {
148  $demand = clone $this;
149  $demand->maxResults = ‪$maxResults;
150 
151  return $demand;
152  }
153 
154  public function ‪addSearchField(string $tableName, string $field): self
155  {
156  $demand = clone $this;
157  $demand->searchFields[$tableName] = $field;
158 
159  return $demand;
160  }
161 
162  public function ‪addOrdering(string $tableName, string $fieldName, string $direction = 'ASC'): self
163  {
164  $demand = clone $this;
165  $demand->orderings[] = [$tableName, $fieldName, $direction];
166 
167  return $demand;
168  }
169 
170  public function ‪withRecursive(): self
171  {
172  $demand = clone $this;
173  $demand->recursive = true;
174 
175  return $demand;
176  }
177 }
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\withSearchTerm
‪withSearchTerm(string $searchTerm)
Definition: FileSearchDemand.php:108
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\addSearchField
‪addSearchField(string $tableName, string $field)
Definition: FileSearchDemand.php:147
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\withStartResult
‪FileSearchDemand withStartResult(int $firstResult)
Definition: FileSearchDemand.php:131
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\isRecursive
‪isRecursive()
Definition: FileSearchDemand.php:103
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\$searchFields
‪array null $searchFields
Definition: FileSearchDemand.php:43
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\addOrdering
‪addOrdering(string $tableName, string $fieldName, string $direction='ASC')
Definition: FileSearchDemand.php:155
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\withFolder
‪withFolder(Folder $folder)
Definition: FileSearchDemand.php:116
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\getFirstResult
‪getFirstResult()
Definition: FileSearchDemand.php:83
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\$firstResult
‪int null $firstResult
Definition: FileSearchDemand.php:35
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\create
‪static create()
Definition: FileSearchDemand.php:63
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\getSearchFields
‪getSearchFields()
Definition: FileSearchDemand.php:93
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand
Definition: FileSearchDemand.php:24
‪TYPO3\CMS\Core\Resource\Folder
Definition: Folder.php:34
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\$orderings
‪array null $orderings
Definition: FileSearchDemand.php:47
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\withMaxResults
‪withMaxResults(int $maxResults)
Definition: FileSearchDemand.php:139
‪TYPO3\CMS\Core\Resource\Search
Definition: FileSearchDemand.php:3
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\getFolder
‪getFolder()
Definition: FileSearchDemand.php:78
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\$recursive
‪bool $recursive
Definition: FileSearchDemand.php:51
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\__construct
‪__construct(string $searchTerm=null)
Definition: FileSearchDemand.php:58
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\$maxResults
‪int null $maxResults
Definition: FileSearchDemand.php:39
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\getMaxResults
‪getMaxResults()
Definition: FileSearchDemand.php:88
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\getOrderings
‪getOrderings()
Definition: FileSearchDemand.php:98
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\getSearchTerm
‪getSearchTerm()
Definition: FileSearchDemand.php:73
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\createForSearchTerm
‪static createForSearchTerm(string $searchTerm)
Definition: FileSearchDemand.php:68
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\$searchTerm
‪string null $searchTerm
Definition: FileSearchDemand.php:27
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\$folder
‪Folder null $folder
Definition: FileSearchDemand.php:31
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\withRecursive
‪withRecursive()
Definition: FileSearchDemand.php:163