@@ -126,8 +126,8 @@ |
||
126 | 126 | ->select(...explode(',', $fields)) |
127 | 127 | ->from($table) |
128 | 128 | ->where( |
129 | - $queryBuilder->expr()->eq($table . '.pid', intval($this->storagePid)), |
|
130 | - $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]), |
|
129 | + $queryBuilder->expr()->eq($table.'.pid', intval($this->storagePid)), |
|
130 | + $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]), |
|
131 | 131 | $andWhere |
132 | 132 | ) |
133 | 133 | ->orderBy($sorting) |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | * @subpackage dlf |
29 | 29 | * @access public |
30 | 30 | */ |
31 | -class ItemsProcFunc implements LoggerAwareInterface |
|
32 | -{ |
|
31 | +class ItemsProcFunc implements LoggerAwareInterface { |
|
33 | 32 | use LoggerAwareTrait; |
34 | 33 | |
35 | 34 | /** |
@@ -46,8 +45,7 @@ discard block |
||
46 | 45 | * |
47 | 46 | * @return void |
48 | 47 | */ |
49 | - public function toolList(&$params) |
|
50 | - { |
|
48 | + public function toolList(&$params) { |
|
51 | 49 | foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'] as $class => $label) { |
52 | 50 | $params['items'][] = [Helper::getLanguageService()->sL($label), $class]; |
53 | 51 | } |
@@ -97,8 +95,7 @@ discard block |
||
97 | 95 | * |
98 | 96 | * @return void |
99 | 97 | */ |
100 | - public function extendedSearchList(&$params) |
|
101 | - { |
|
98 | + public function extendedSearchList(&$params) { |
|
102 | 99 | $this->generateList( |
103 | 100 | $params, |
104 | 101 | 'label,index_name', |
@@ -139,8 +136,7 @@ discard block |
||
139 | 136 | * |
140 | 137 | * @return void |
141 | 138 | */ |
142 | - protected function generateList(&$params, $fields, $table, $sorting, $andWhere = '') |
|
143 | - { |
|
139 | + protected function generateList(&$params, $fields, $table, $sorting, $andWhere = '') { |
|
144 | 140 | $this->getTyposcriptConfigFromPluginSiteRoot($params); |
145 | 141 | |
146 | 142 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -22,7 +22,7 @@ |
||
22 | 22 | // parameters are available in $this->data['parameterArray']['fieldConf']['config']['parameters'] |
23 | 23 | $result = $this->initializeResultArray(); |
24 | 24 | if (!empty($this->data['databaseRow']['thumbnail'])) { |
25 | - $result['html'] = '<img alt="Thumbnail" title="" src="' . $this->data['databaseRow']['thumbnail'] . '" />'; |
|
25 | + $result['html'] = '<img alt="Thumbnail" title="" src="'.$this->data['databaseRow']['thumbnail'].'" />'; |
|
26 | 26 | } else { |
27 | 27 | $result['html'] = ''; |
28 | 28 | } |
@@ -14,10 +14,8 @@ |
||
14 | 14 | |
15 | 15 | use TYPO3\CMS\Backend\Form\Element\AbstractFormElement; |
16 | 16 | |
17 | -class ThumbnailCustomElement extends AbstractFormElement |
|
18 | -{ |
|
19 | - public function render() |
|
20 | - { |
|
17 | +class ThumbnailCustomElement extends AbstractFormElement { |
|
18 | + public function render() { |
|
21 | 19 | // Custom TCA properties and other data can be found in $this->data, for example the above |
22 | 20 | // parameters are available in $this->data['parameterArray']['fieldConf']['config']['parameters'] |
23 | 21 | $result = $this->initializeResultArray(); |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | * @subpackage dlf |
30 | 30 | * @access public |
31 | 31 | */ |
32 | -class ConfigurationForm |
|
33 | -{ |
|
32 | +class ConfigurationForm { |
|
34 | 33 | |
35 | 34 | /** |
36 | 35 | * Check if a connection to a Solr server could be established with the given credentials. |
@@ -39,8 +38,7 @@ discard block |
||
39 | 38 | * |
40 | 39 | * @return string Message informing the user of success or failure |
41 | 40 | */ |
42 | - public function checkSolrConnection() |
|
43 | - { |
|
41 | + public function checkSolrConnection() { |
|
44 | 42 | $solr = Solr::getInstance(); |
45 | 43 | if ($solr->ready) { |
46 | 44 | Helper::addMessage( |
@@ -65,8 +63,7 @@ discard block |
||
65 | 63 | * |
66 | 64 | * @return void |
67 | 65 | */ |
68 | - public function __construct() |
|
69 | - { |
|
66 | + public function __construct() { |
|
70 | 67 | // Load backend localization file. |
71 | 68 | Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_be.xlf'); |
72 | 69 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @var \Kitodo\Dlf\Common\Doc|null |
42 | 42 | */ |
43 | - protected $doc = null; |
|
43 | + protected $doc = NULL; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * @var string |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Kitodo\Dlf\Domain\Model\Collection> |
157 | 157 | * @Extbase\ORM\Lazy |
158 | 158 | */ |
159 | - protected $collections = null; |
|
159 | + protected $collections = NULL; |
|
160 | 160 | |
161 | 161 | /** |
162 | 162 | * @var string |
@@ -192,14 +192,12 @@ discard block |
||
192 | 192 | /** |
193 | 193 | * constructor |
194 | 194 | */ |
195 | - public function __construct() |
|
196 | - { |
|
195 | + public function __construct() { |
|
197 | 196 | // Do not remove the next line: It would break the functionality |
198 | 197 | $this->initStorageObjects(); |
199 | 198 | } |
200 | 199 | |
201 | - protected function initStorageObjects() |
|
202 | - { |
|
200 | + protected function initStorageObjects() { |
|
203 | 201 | $this->collections = new ObjectStorage(); |
204 | 202 | } |
205 | 203 | |
@@ -577,8 +575,7 @@ discard block |
||
577 | 575 | * |
578 | 576 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Kitodo\Dlf\Domain\Model\Collection> $collections |
579 | 577 | */ |
580 | - public function getCollections() |
|
581 | - { |
|
578 | + public function getCollections() { |
|
582 | 579 | return $this->collections; |
583 | 580 | } |
584 | 581 | |
@@ -607,8 +604,7 @@ discard block |
||
607 | 604 | * |
608 | 605 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Kitodo\Dlf\Domain\Model\Collection> collections |
609 | 606 | */ |
610 | - public function removeCollection(Collection $collection) |
|
611 | - { |
|
607 | + public function removeCollection(Collection $collection) { |
|
612 | 608 | $this->collections->detach($collection); |
613 | 609 | } |
614 | 610 |
@@ -61,7 +61,7 @@ |
||
61 | 61 | * |
62 | 62 | * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference |
63 | 63 | */ |
64 | - protected $thumbnail = null; |
|
64 | + protected $thumbnail = NULL; |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * @var int |
@@ -47,7 +47,7 @@ |
||
47 | 47 | |
48 | 48 | // order by oai_name |
49 | 49 | $query->setOrderings( |
50 | - array('sorting' => QueryInterface::ORDER_ASCENDING) |
|
50 | + array ('sorting' => QueryInterface::ORDER_ASCENDING) |
|
51 | 51 | ); |
52 | 52 | |
53 | 53 | return $query->execute(); |
@@ -25,8 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
27 | 27 | */ |
28 | - public function findBySettings($settings = []) |
|
29 | - { |
|
28 | + public function findBySettings($settings = []) { |
|
30 | 29 | $query = $this->createQuery(); |
31 | 30 | |
32 | 31 | $constraints = []; |
@@ -98,7 +98,7 @@ |
||
98 | 98 | |
99 | 99 | // order by oai_name |
100 | 100 | $query->setOrderings( |
101 | - array('oai_name' => QueryInterface::ORDER_ASCENDING) |
|
101 | + array ('oai_name' => QueryInterface::ORDER_ASCENDING) |
|
102 | 102 | ); |
103 | 103 | |
104 | 104 | return $query->execute(); |
@@ -35,8 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
37 | 37 | */ |
38 | - public function findAllByUids($uids) |
|
39 | - { |
|
38 | + public function findAllByUids($uids) { |
|
40 | 39 | $query = $this->createQuery(); |
41 | 40 | |
42 | 41 | $constraints = []; |
@@ -49,8 +48,7 @@ discard block |
||
49 | 48 | return $query->execute(); |
50 | 49 | } |
51 | 50 | |
52 | - public function getCollectionForMetadata($pages) |
|
53 | - { |
|
51 | + public function getCollectionForMetadata($pages) { |
|
54 | 52 | // Get list of collections to show. |
55 | 53 | $query = $this->createQuery(); |
56 | 54 | |
@@ -66,8 +64,7 @@ discard block |
||
66 | 64 | * |
67 | 65 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
68 | 66 | */ |
69 | - public function findCollectionsBySettings($settings = []) |
|
70 | - { |
|
67 | + public function findCollectionsBySettings($settings = []) { |
|
71 | 68 | $query = $this->createQuery(); |
72 | 69 | |
73 | 70 | $constraints = []; |
@@ -104,8 +101,7 @@ discard block |
||
104 | 101 | return $query->execute(); |
105 | 102 | } |
106 | 103 | |
107 | - public function getIndexNameForSolr($settings, $set) |
|
108 | - { |
|
104 | + public function getIndexNameForSolr($settings, $set) { |
|
109 | 105 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
110 | 106 | ->getQueryBuilderForTable('tx_dlf_collections'); |
111 | 107 |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | if ($this->document) { |
158 | 158 | $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], true); |
159 | 159 | } else { |
160 | - $this->logger->error('Invalid UID "' . $requestData['id'] . '" or PID "' . $pid . '" for document loading'); |
|
160 | + $this->logger->error('Invalid UID "'.$requestData['id'].'" or PID "'.$pid.'" for document loading'); |
|
161 | 161 | } |
162 | 162 | } else if (GeneralUtility::isValidUrl($requestData['id'])) { |
163 | 163 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | $this->document->setLocation($requestData['id']); |
177 | 177 | } else { |
178 | - $this->logger->error('Invalid location given "' . $requestData['id'] . '" for document loading'); |
|
178 | + $this->logger->error('Invalid location given "'.$requestData['id'].'" for document loading'); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | if ($this->document !== null && $doc !== null) { |
193 | 193 | $this->document->setDoc($doc); |
194 | 194 | } else { |
195 | - $this->logger->error('Failed to load document with record ID "' . $requestData['recordId'] . '"'); |
|
195 | + $this->logger->error('Failed to load document with record ID "'.$requestData['recordId'].'"'); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | } else { |
199 | - $this->logger->error('Invalid UID "' . $requestData['id'] . '" or PID "' . $pid . '" for document loading'); |
|
199 | + $this->logger->error('Invalid UID "'.$requestData['id'].'" or PID "'.$pid.'" for document loading'); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | } |
@@ -41,8 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * @return ExpressionFunction[] An array of Function instances |
43 | 43 | */ |
44 | - public function getFunctions() |
|
45 | - { |
|
44 | + public function getFunctions() { |
|
46 | 45 | return [ |
47 | 46 | $this->getDocumentTypeFunction(), |
48 | 47 | ]; |
@@ -68,8 +67,7 @@ discard block |
||
68 | 67 | * |
69 | 68 | * @return void |
70 | 69 | */ |
71 | - protected function initializeRepositories($storagePid) |
|
72 | - { |
|
70 | + protected function initializeRepositories($storagePid) { |
|
73 | 71 | Helper::polyfillExtbaseClassesForTYPO3v9(); |
74 | 72 | |
75 | 73 | // TODO: When we drop support for TYPO3v9, we needn't/shouldn't use ObjectManager anymore |
@@ -92,12 +90,10 @@ discard block |
||
92 | 90 | { |
93 | 91 | return new ExpressionFunction( |
94 | 92 | 'getDocumentType', |
95 | - function() |
|
96 | - { |
|
93 | + function() { |
|
97 | 94 | // Not implemented, we only use the evaluator |
98 | 95 | }, |
99 | - function($arguments, $cPid) |
|
100 | - { |
|
96 | + function($arguments, $cPid) { |
|
101 | 97 | /** @var RequestWrapper $requestWrapper */ |
102 | 98 | $requestWrapper = $arguments['request']; |
103 | 99 | $queryParams = $requestWrapper->getQueryParams(); |
@@ -143,8 +139,7 @@ discard block |
||
143 | 139 | * |
144 | 140 | * @return void |
145 | 141 | */ |
146 | - protected function loadDocument($requestData, int $pid) |
|
147 | - { |
|
142 | + protected function loadDocument($requestData, int $pid) { |
|
148 | 143 | // Try to get document format from database |
149 | 144 | if (!empty($requestData['id'])) { |
150 | 145 |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | // Load document with current plugin parameters. |
114 | 114 | $this->loadDocument($queryParams['tx_dlf'], $cPid); |
115 | - if ($this->document === null) { |
|
115 | + if ($this->document === NULL) { |
|
116 | 116 | return $type; |
117 | 117 | } |
118 | 118 | // Set PID for metadata definitions. |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | // Calendar plugin does not support IIIF (yet). Abort for all newspaper related types. |
124 | 124 | if ( |
125 | 125 | $this->document->getDoc() instanceof IiifManifest |
126 | - && array_search($metadata['type'][0], ['newspaper', 'ephemera', 'year', 'issue']) !== false |
|
126 | + && array_search($metadata['type'][0], ['newspaper', 'ephemera', 'year', 'issue']) !== FALSE |
|
127 | 127 | ) { |
128 | 128 | return $type; |
129 | 129 | } |
@@ -150,25 +150,25 @@ discard block |
||
150 | 150 | |
151 | 151 | $this->initializeRepositories($pid); |
152 | 152 | |
153 | - $doc = null; |
|
153 | + $doc = NULL; |
|
154 | 154 | if (MathUtility::canBeInterpretedAsInteger($requestData['id'])) { |
155 | 155 | // find document from repository by uid |
156 | 156 | $this->document = $this->documentRepository->findOneByIdAndSettings((int) $requestData['id'], ['storagePid' => $pid]); |
157 | 157 | if ($this->document) { |
158 | - $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], true); |
|
158 | + $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], TRUE); |
|
159 | 159 | } else { |
160 | 160 | $this->logger->error('Invalid UID "' . $requestData['id'] . '" or PID "' . $pid . '" for document loading'); |
161 | 161 | } |
162 | 162 | } else if (GeneralUtility::isValidUrl($requestData['id'])) { |
163 | 163 | |
164 | - $doc = Doc::getInstance($requestData['id'], ['storagePid' => $pid], true); |
|
164 | + $doc = Doc::getInstance($requestData['id'], ['storagePid' => $pid], TRUE); |
|
165 | 165 | |
166 | - if ($doc !== null) { |
|
166 | + if ($doc !== NULL) { |
|
167 | 167 | if ($doc->recordId) { |
168 | 168 | $this->document = $this->documentRepository->findOneByRecordId($doc->recordId); |
169 | 169 | } |
170 | 170 | |
171 | - if ($this->document === null) { |
|
171 | + if ($this->document === NULL) { |
|
172 | 172 | // create new dummy Document object |
173 | 173 | $this->document = GeneralUtility::makeInstance(Document::class); |
174 | 174 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
182 | - if ($this->document !== null && $doc !== null) { |
|
182 | + if ($this->document !== NULL && $doc !== NULL) { |
|
183 | 183 | $this->document->setDoc($doc); |
184 | 184 | } |
185 | 185 | |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | |
188 | 188 | $this->document = $this->documentRepository->findOneByRecordId($requestData['recordId']); |
189 | 189 | |
190 | - if ($this->document !== null) { |
|
191 | - $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], true); |
|
192 | - if ($this->document !== null && $doc !== null) { |
|
190 | + if ($this->document !== NULL) { |
|
191 | + $doc = Doc::getInstance($this->document->getLocation(), ['storagePid' => $pid], TRUE); |
|
192 | + if ($this->document !== NULL && $doc !== NULL) { |
|
193 | 193 | $this->document->setDoc($doc); |
194 | 194 | } else { |
195 | 195 | $this->logger->error('Failed to load document with record ID "' . $requestData['recordId'] . '"'); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | { |
135 | 135 | // Get next available core name if none given. |
136 | 136 | if (empty($core)) { |
137 | - $core = 'dlfCore' . self::getNextCoreNumber(); |
|
137 | + $core = 'dlfCore'.self::getNextCoreNumber(); |
|
138 | 138 | } |
139 | 139 | // Get Solr service instance. |
140 | 140 | $solr = self::getInstance($core); |
@@ -230,13 +230,13 @@ discard block |
||
230 | 230 | ->execute(); |
231 | 231 | |
232 | 232 | while ($resArray = $result->fetch()) { |
233 | - $fields[] = $resArray['index_name'] . '_' . ($resArray['index_tokenized'] ? 't' : 'u') . ($resArray['index_stored'] ? 's' : 'u') . 'i'; |
|
233 | + $fields[] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').($resArray['index_stored'] ? 's' : 'u').'i'; |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | // Check if queried field is valid. |
237 | 237 | $splitQuery = explode(':', $query, 2); |
238 | 238 | if (in_array($splitQuery[0], $fields)) { |
239 | - $query = $splitQuery[0] . ':(' . self::escapeQuery(trim($splitQuery[1], '()')) . ')'; |
|
239 | + $query = $splitQuery[0].':('.self::escapeQuery(trim($splitQuery[1], '()')).')'; |
|
240 | 240 | } else { |
241 | 241 | $query = self::escapeQuery($query); |
242 | 242 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | { |
342 | 342 | $number = max(intval($number), 0); |
343 | 343 | // Check if core already exists. |
344 | - $solr = self::getInstance('dlfCore' . $number); |
|
344 | + $solr = self::getInstance('dlfCore'.$number); |
|
345 | 345 | if (!$solr->ready) { |
346 | 346 | return $number; |
347 | 347 | } else { |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $parameters['start'] = 0; |
404 | 404 | $parameters['rows'] = $this->limit; |
405 | 405 | // Calculate cache identifier. |
406 | - $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), true)); |
|
406 | + $cacheIdentifier = Helper::digest($this->core.print_r(array_merge($this->params, $parameters), true)); |
|
407 | 407 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
408 | 408 | $resultSet = []; |
409 | 409 | if (($entry = $cache->get($cacheIdentifier)) === false) { |
@@ -534,12 +534,12 @@ discard block |
||
534 | 534 | */ |
535 | 535 | public function __get($var) |
536 | 536 | { |
537 | - $method = '_get' . ucfirst($var); |
|
537 | + $method = '_get'.ucfirst($var); |
|
538 | 538 | if ( |
539 | 539 | !property_exists($this, $var) |
540 | 540 | || !method_exists($this, $method) |
541 | 541 | ) { |
542 | - $this->logger->warning('There is no getter function for property "' . $var . '"'); |
|
542 | + $this->logger->warning('There is no getter function for property "'.$var.'"'); |
|
543 | 543 | return; |
544 | 544 | } else { |
545 | 545 | return $this->$method(); |
@@ -572,12 +572,12 @@ discard block |
||
572 | 572 | */ |
573 | 573 | public function __set($var, $value) |
574 | 574 | { |
575 | - $method = '_set' . ucfirst($var); |
|
575 | + $method = '_set'.ucfirst($var); |
|
576 | 576 | if ( |
577 | 577 | !property_exists($this, $var) |
578 | 578 | || !method_exists($this, $method) |
579 | 579 | ) { |
580 | - $this->logger->warning('There is no setter function for property "' . $var . '"'); |
|
580 | + $this->logger->warning('There is no setter function for property "'.$var.'"'); |
|
581 | 581 | } else { |
582 | 582 | $this->$method($value); |
583 | 583 | } |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | 'scheme' => $this->config['scheme'], |
615 | 615 | 'host' => $this->config['host'], |
616 | 616 | 'port' => $this->config['port'], |
617 | - 'path' => '/' . $this->config['path'], |
|
617 | + 'path' => '/'.$this->config['path'], |
|
618 | 618 | 'core' => $core, |
619 | 619 | 'username' => $this->config['username'], |
620 | 620 | 'password' => $this->config['password'], |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | * @property-read bool $ready Is the Solr service instantiated successfully? |
38 | 38 | * @property-read \Solarium\Client $service This holds the Solr service object |
39 | 39 | */ |
40 | -class Solr implements LoggerAwareInterface |
|
41 | -{ |
|
40 | +class Solr implements LoggerAwareInterface { |
|
42 | 41 | use LoggerAwareTrait; |
43 | 42 | |
44 | 43 | /** |
@@ -130,8 +129,7 @@ discard block |
||
130 | 129 | * |
131 | 130 | * @return string The name of the new core |
132 | 131 | */ |
133 | - public static function createCore($core = '') |
|
134 | - { |
|
132 | + public static function createCore($core = '') { |
|
135 | 133 | // Get next available core name if none given. |
136 | 134 | if (empty($core)) { |
137 | 135 | $core = 'dlfCore' . self::getNextCoreNumber(); |
@@ -178,8 +176,7 @@ discard block |
||
178 | 176 | * |
179 | 177 | * @return string The escaped query string |
180 | 178 | */ |
181 | - public static function escapeQuery($query) |
|
182 | - { |
|
179 | + public static function escapeQuery($query) { |
|
183 | 180 | $helper = GeneralUtility::makeInstance(\Solarium\Core\Query\Helper::class); |
184 | 181 | // Escape query phrase or term. |
185 | 182 | if (preg_match('/^".*"$/', $query)) { |
@@ -202,8 +199,7 @@ discard block |
||
202 | 199 | * |
203 | 200 | * @return string The escaped query string |
204 | 201 | */ |
205 | - public static function escapeQueryKeepField($query, $pid) |
|
206 | - { |
|
202 | + public static function escapeQueryKeepField($query, $pid) { |
|
207 | 203 | // Is there a field query? |
208 | 204 | if (preg_match('/^[[:alnum:]]+_[tu][su]i:\(?.*\)?$/', $query)) { |
209 | 205 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -253,8 +249,7 @@ discard block |
||
253 | 249 | * |
254 | 250 | * @return array fields |
255 | 251 | */ |
256 | - public static function getFields() |
|
257 | - { |
|
252 | + public static function getFields() { |
|
258 | 253 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
259 | 254 | |
260 | 255 | $fields = []; |
@@ -296,8 +291,7 @@ discard block |
||
296 | 291 | * |
297 | 292 | * @return \Kitodo\Dlf\Common\Solr Instance of this class |
298 | 293 | */ |
299 | - public static function getInstance($core = null) |
|
300 | - { |
|
294 | + public static function getInstance($core = null) { |
|
301 | 295 | // Get core name if UID is given. |
302 | 296 | if (MathUtility::canBeInterpretedAsInteger($core)) { |
303 | 297 | $core = Helper::getIndexNameFromUid($core, 'tx_dlf_solrcores'); |
@@ -337,8 +331,7 @@ discard block |
||
337 | 331 | * |
338 | 332 | * @return int First unused core number found |
339 | 333 | */ |
340 | - public static function getNextCoreNumber($number = 0) |
|
341 | - { |
|
334 | + public static function getNextCoreNumber($number = 0) { |
|
342 | 335 | $number = max(intval($number), 0); |
343 | 336 | // Check if core already exists. |
344 | 337 | $solr = self::getInstance('dlfCore' . $number); |
@@ -356,8 +349,7 @@ discard block |
||
356 | 349 | * |
357 | 350 | * @return void |
358 | 351 | */ |
359 | - protected function loadSolrConnectionInfo() |
|
360 | - { |
|
352 | + protected function loadSolrConnectionInfo() { |
|
361 | 353 | if (empty($this->config)) { |
362 | 354 | $config = []; |
363 | 355 | // Extract extension configuration. |
@@ -397,8 +389,7 @@ discard block |
||
397 | 389 | * |
398 | 390 | * @return array The Apache Solr Documents that were fetched |
399 | 391 | */ |
400 | - public function search_raw($parameters = []) |
|
401 | - { |
|
392 | + public function search_raw($parameters = []) { |
|
402 | 393 | // Set additional query parameters. |
403 | 394 | $parameters['start'] = 0; |
404 | 395 | $parameters['rows'] = $this->limit; |
@@ -428,8 +419,7 @@ discard block |
||
428 | 419 | * |
429 | 420 | * @return string|null The core name of the current query endpoint or null if core admin endpoint |
430 | 421 | */ |
431 | - protected function _getCore() |
|
432 | - { |
|
422 | + protected function _getCore() { |
|
433 | 423 | return $this->core; |
434 | 424 | } |
435 | 425 | |
@@ -440,8 +430,7 @@ discard block |
||
440 | 430 | * |
441 | 431 | * @return int The max number of results |
442 | 432 | */ |
443 | - protected function _getLimit() |
|
444 | - { |
|
433 | + protected function _getLimit() { |
|
445 | 434 | return $this->limit; |
446 | 435 | } |
447 | 436 | |
@@ -452,8 +441,7 @@ discard block |
||
452 | 441 | * |
453 | 442 | * @return int Total number of hits for last search |
454 | 443 | */ |
455 | - protected function _getNumberOfHits() |
|
456 | - { |
|
444 | + protected function _getNumberOfHits() { |
|
457 | 445 | return $this->numberOfHits; |
458 | 446 | } |
459 | 447 | |
@@ -464,8 +452,7 @@ discard block |
||
464 | 452 | * |
465 | 453 | * @return bool Is the search instantiated successfully? |
466 | 454 | */ |
467 | - protected function _getReady() |
|
468 | - { |
|
455 | + protected function _getReady() { |
|
469 | 456 | return $this->ready; |
470 | 457 | } |
471 | 458 | |
@@ -476,8 +463,7 @@ discard block |
||
476 | 463 | * |
477 | 464 | * @return \Solarium\Client Apache Solr service object |
478 | 465 | */ |
479 | - protected function _getService() |
|
480 | - { |
|
466 | + protected function _getService() { |
|
481 | 467 | return $this->service; |
482 | 468 | } |
483 | 469 | |
@@ -490,8 +476,7 @@ discard block |
||
490 | 476 | * |
491 | 477 | * @return void |
492 | 478 | */ |
493 | - protected function _setCPid($value) |
|
494 | - { |
|
479 | + protected function _setCPid($value) { |
|
495 | 480 | $this->cPid = max(intval($value), 0); |
496 | 481 | } |
497 | 482 | |
@@ -504,8 +489,7 @@ discard block |
||
504 | 489 | * |
505 | 490 | * @return void |
506 | 491 | */ |
507 | - protected function _setLimit($value) |
|
508 | - { |
|
492 | + protected function _setLimit($value) { |
|
509 | 493 | $this->limit = max(intval($value), 0); |
510 | 494 | } |
511 | 495 | |
@@ -518,8 +502,7 @@ discard block |
||
518 | 502 | * |
519 | 503 | * @return void |
520 | 504 | */ |
521 | - protected function _setParams(array $value) |
|
522 | - { |
|
505 | + protected function _setParams(array $value) { |
|
523 | 506 | $this->params = $value; |
524 | 507 | } |
525 | 508 | |
@@ -532,8 +515,7 @@ discard block |
||
532 | 515 | * |
533 | 516 | * @return mixed Value of $this->$var |
534 | 517 | */ |
535 | - public function __get($var) |
|
536 | - { |
|
518 | + public function __get($var) { |
|
537 | 519 | $method = '_get' . ucfirst($var); |
538 | 520 | if ( |
539 | 521 | !property_exists($this, $var) |
@@ -555,8 +537,7 @@ discard block |
||
555 | 537 | * |
556 | 538 | * @return bool true if variable is set and not empty, false otherwise |
557 | 539 | */ |
558 | - public function __isset($var) |
|
559 | - { |
|
540 | + public function __isset($var) { |
|
560 | 541 | return !empty($this->__get($var)); |
561 | 542 | } |
562 | 543 | |
@@ -570,8 +551,7 @@ discard block |
||
570 | 551 | * |
571 | 552 | * @return void |
572 | 553 | */ |
573 | - public function __set($var, $value) |
|
574 | - { |
|
554 | + public function __set($var, $value) { |
|
575 | 555 | $method = '_set' . ucfirst($var); |
576 | 556 | if ( |
577 | 557 | !property_exists($this, $var) |
@@ -592,8 +572,7 @@ discard block |
||
592 | 572 | * |
593 | 573 | * @return void |
594 | 574 | */ |
595 | - protected function __construct($core) |
|
596 | - { |
|
575 | + protected function __construct($core) { |
|
597 | 576 | // Get Solr connection parameters from configuration. |
598 | 577 | $this->loadSolrConnectionInfo(); |
599 | 578 | // Configure connection adapter. |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @var string|null |
56 | 56 | * @access protected |
57 | 57 | */ |
58 | - protected $core = null; |
|
58 | + protected $core = NULL; |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * This holds the PID for the configuration |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @var bool |
104 | 104 | * @access protected |
105 | 105 | */ |
106 | - protected $ready = false; |
|
106 | + protected $ready = FALSE; |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * This holds the singleton search objects with their core as array key |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * |
297 | 297 | * @return \Kitodo\Dlf\Common\Solr Instance of this class |
298 | 298 | */ |
299 | - public static function getInstance($core = null) |
|
299 | + public static function getInstance($core = NULL) |
|
300 | 300 | { |
301 | 301 | // Get core name if UID is given. |
302 | 302 | if (MathUtility::canBeInterpretedAsInteger($core)) { |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | // Check if core is set or null. |
306 | 306 | if ( |
307 | 307 | empty($core) |
308 | - && $core !== null |
|
308 | + && $core !== NULL |
|
309 | 309 | ) { |
310 | 310 | Helper::log('Invalid core UID or name given for Apache Solr', LOG_SEVERITY_ERROR); |
311 | 311 | } |
@@ -403,10 +403,10 @@ discard block |
||
403 | 403 | $parameters['start'] = 0; |
404 | 404 | $parameters['rows'] = $this->limit; |
405 | 405 | // Calculate cache identifier. |
406 | - $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), true)); |
|
406 | + $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), TRUE)); |
|
407 | 407 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
408 | 408 | $resultSet = []; |
409 | - if (($entry = $cache->get($cacheIdentifier)) === false) { |
|
409 | + if (($entry = $cache->get($cacheIdentifier)) === FALSE) { |
|
410 | 410 | $selectQuery = $this->service->createSelect(array_merge($this->params, $parameters)); |
411 | 411 | $result = $this->service->select($selectQuery); |
412 | 412 | foreach ($result as $doc) { |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | // Check if connection is established. |
633 | 633 | $query = $this->service->createCoreAdmin(); |
634 | 634 | $action = $query->createStatus(); |
635 | - if ($core !== null) { |
|
635 | + if ($core !== NULL) { |
|
636 | 636 | $action->setCore($core); |
637 | 637 | } |
638 | 638 | $query->setAction($action); |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | $response = $this->service->coreAdmin($query); |
641 | 641 | if ($response->getWasSuccessful()) { |
642 | 642 | // Solr is reachable, but is the core as well? |
643 | - if ($core !== null) { |
|
643 | + if ($core !== NULL) { |
|
644 | 644 | $result = $response->getStatusResult(); |
645 | 645 | if ( |
646 | 646 | $result instanceof \Solarium\QueryType\Server\CoreAdmin\Result\StatusResult |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | } |
655 | 655 | } |
656 | 656 | // Instantiation successful! |
657 | - $this->ready = true; |
|
657 | + $this->ready = TRUE; |
|
658 | 658 | } |
659 | 659 | } catch (\Exception $e) { |
660 | 660 | // Nothing to do here. |