Passed
Pull Request — master (#50)
by
unknown
03:12
created
Classes/Common/Solr.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     {
129 129
         // Get next available core name if none given.
130 130
         if (empty($core)) {
131
-            $core = 'dlfCore' . self::getNextCoreNumber();
131
+            $core = 'dlfCore'.self::getNextCoreNumber();
132 132
         }
133 133
         // Get Solr service instance.
134 134
         $solr = self::getInstance($core);
@@ -224,13 +224,13 @@  discard block
 block discarded – undo
224 224
                 ->execute();
225 225
 
226 226
             while ($resArray = $result->fetch()) {
227
-                $fields[] = $resArray['index_name'] . '_' . ($resArray['index_tokenized'] ? 't' : 'u') . ($resArray['index_stored'] ? 's' : 'u') . 'i';
227
+                $fields[] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').($resArray['index_stored'] ? 's' : 'u').'i';
228 228
             }
229 229
 
230 230
             // Check if queried field is valid.
231 231
             $splitQuery = explode(':', $query, 2);
232 232
             if (in_array($splitQuery[0], $fields)) {
233
-                $query = $splitQuery[0] . ':(' . self::escapeQuery(trim($splitQuery[1], '()')) . ')';
233
+                $query = $splitQuery[0].':('.self::escapeQuery(trim($splitQuery[1], '()')).')';
234 234
             } else {
235 235
                 $query = self::escapeQuery($query);
236 236
             }
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     {
295 295
         $number = max(intval($number), 0);
296 296
         // Check if core already exists.
297
-        $solr = self::getInstance('dlfCore' . $number);
297
+        $solr = self::getInstance('dlfCore'.$number);
298 298
         if (!$solr->ready) {
299 299
             return $number;
300 300
         } else {
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
                 $config['path'] .= 'solr/';
336 336
             }
337 337
             // Set connection timeout lower than PHP's max_execution_time.
338
-            $max_execution_time = intval(ini_get('max_execution_time')) ?: 30;
338
+            $max_execution_time = intval(ini_get('max_execution_time')) ? : 30;
339 339
             $config['timeout'] = MathUtility::forceIntegerInRange($conf['solrTimeout'], 1, $max_execution_time, 10);
340 340
             $this->config = $config;
341 341
         }
@@ -369,13 +369,13 @@  discard block
 block discarded – undo
369 369
         // Extend filter query to get all documents with the same uids.
370 370
         foreach ($params['filterquery'] as $key => $value) {
371 371
             if (isset($value['query'])) {
372
-                $params['filterquery'][$key]['query'] = '{!join from=uid to=uid}' . $value['query'];
372
+                $params['filterquery'][$key]['query'] = '{!join from=uid to=uid}'.$value['query'];
373 373
             }
374 374
         }
375 375
         // Set filter query to just get toplevel documents.
376 376
         $params['filterquery'][] = ['query' => 'toplevel:true'];
377 377
         // Set join query to get all documents with the same uids.
378
-        $params['query'] = '{!join from=uid to=uid}' . $params['query'];
378
+        $params['query'] = '{!join from=uid to=uid}'.$params['query'];
379 379
         // Perform search to determine the total number of toplevel hits and fetch the required rows.
380 380
         $selectQuery = $this->service->createSelect($params);
381 381
         $results = $this->service->select($selectQuery);
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
         $parameters['query'] = $query;
434 434
 
435 435
         // calculate cache identifier
436
-        $cacheIdentifier = hash('md5', $this->core . print_r(array_merge($this->params, $parameters), 1));
436
+        $cacheIdentifier = hash('md5', $this->core.print_r(array_merge($this->params, $parameters), 1));
437 437
         $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr');
438 438
 
439 439
         $resultSet = [];
@@ -565,12 +565,12 @@  discard block
 block discarded – undo
565 565
      */
566 566
     public function __get($var)
567 567
     {
568
-        $method = '_get' . ucfirst($var);
568
+        $method = '_get'.ucfirst($var);
569 569
         if (
570 570
             !property_exists($this, $var)
571 571
             || !method_exists($this, $method)
572 572
         ) {
573
-            Helper::devLog('There is no getter function for property "' . $var . '"', DEVLOG_SEVERITY_WARNING);
573
+            Helper::devLog('There is no getter function for property "'.$var.'"', DEVLOG_SEVERITY_WARNING);
574 574
             return;
575 575
         } else {
576 576
             return $this->$method();
@@ -603,12 +603,12 @@  discard block
 block discarded – undo
603 603
      */
604 604
     public function __set($var, $value)
605 605
     {
606
-        $method = '_set' . ucfirst($var);
606
+        $method = '_set'.ucfirst($var);
607 607
         if (
608 608
             !property_exists($this, $var)
609 609
             || !method_exists($this, $method)
610 610
         ) {
611
-            Helper::devLog('There is no setter function for property "' . $var . '"', DEVLOG_SEVERITY_WARNING);
611
+            Helper::devLog('There is no setter function for property "'.$var.'"', DEVLOG_SEVERITY_WARNING);
612 612
         } else {
613 613
             $this->$method($value);
614 614
         }
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
                     'scheme' => $this->config['scheme'],
646 646
                     'host' => $this->config['host'],
647 647
                     'port' => $this->config['port'],
648
-                    'path' => '/' . $this->config['path'],
648
+                    'path' => '/'.$this->config['path'],
649 649
                     'core' => $core,
650 650
                     'username' => $this->config['username'],
651 651
                     'password' => $this->config['password'],
Please login to merge, or discard this patch.
Upper-Lower-Casing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * @var string|null
50 50
      * @access protected
51 51
      */
52
-    protected $core = null;
52
+    protected $core = NULL;
53 53
 
54 54
     /**
55 55
      * This holds the PID for the configuration
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      * @var bool
98 98
      * @access protected
99 99
      */
100
-    protected $ready = false;
100
+    protected $ready = FALSE;
101 101
 
102 102
     /**
103 103
      * This holds the singleton search objects with their core as array key
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      *
250 250
      * @return \Kitodo\Dlf\Common\Solr Instance of this class
251 251
      */
252
-    public static function getInstance($core = null)
252
+    public static function getInstance($core = NULL)
253 253
     {
254 254
         // Get core name if UID is given.
255 255
         if (MathUtility::canBeInterpretedAsInteger($core)) {
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         // Check if core is set or null.
259 259
         if (
260 260
             empty($core)
261
-            && $core !== null
261
+            && $core !== NULL
262 262
         ) {
263 263
             Helper::devLog('Invalid core UID or name given for Apache Solr', DEVLOG_SEVERITY_ERROR);
264 264
         }
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
                 'core' => $this->core,
407 407
                 'pid' => $this->cPid,
408 408
                 'order' => 'score',
409
-                'order.asc' => true,
409
+                'order.asc' => TRUE,
410 410
                 'numberOfHits' => $this->numberOfHits,
411 411
                 'numberOfToplevelHits' => $numberOfToplevelHits
412 412
             ]
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
         $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr');
438 438
 
439 439
         $resultSet = [];
440
-        if (($entry = $cache->get($cacheIdentifier)) === false) {
440
+        if (($entry = $cache->get($cacheIdentifier)) === FALSE) {
441 441
             $selectQuery = $this->service->createSelect(array_merge($this->params, $parameters));
442 442
             $result = $this->service->select($selectQuery);
443 443
             foreach ($result as $doc) {
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
         // Check if connection is established.
664 664
         $query = $this->service->createCoreAdmin();
665 665
         $action = $query->createStatus();
666
-        if ($core !== null) {
666
+        if ($core !== NULL) {
667 667
             $action->setCore($core);
668 668
         }
669 669
         $query->setAction($action);
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
             $response = $this->service->coreAdmin($query);
672 672
             if ($response->getWasSuccessful()) {
673 673
                 // Solr is reachable, but is the core as well?
674
-                if ($core !== null) {
674
+                if ($core !== NULL) {
675 675
                     $result = $response->getStatusResult();
676 676
                     if (
677 677
                         $result instanceof \Solarium\QueryType\Server\CoreAdmin\Result\StatusResult
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
                     }
686 686
                 }
687 687
                 // Instantiation successful!
688
-                $this->ready = true;
688
+                $this->ready = TRUE;
689 689
             }
690 690
         } catch (\Exception $e) {
691 691
             // Nothing to do here.
Please login to merge, or discard this patch.