From 903f3e2ca1c5f4b66b4bb40d9aa778aee31479b8 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Thu, 25 Jun 2015 12:02:07 -0400
Subject: [PATCH] Fixes from upgraded php-cs-fixer.

---
 .../VuDL/src/VuDL/Connection/AbstractBase.php |  2 +-
 module/VuDL/src/VuDL/Connection/Fedora.php    | 12 +--
 .../src/VuDL/Controller/VudlController.php    |  8 +-
 module/VuFind/src/VuFind/Cart.php             |  2 +-
 .../VuFind/Config/Reader/CacheDecorator.php   |  1 -
 .../Controller/CollectionsController.php      |  2 +-
 .../src/VuFind/Controller/CoverController.php |  4 +-
 .../VuFind/Controller/HierarchyController.php |  2 +-
 .../Controller/MyResearchController.php       |  4 +-
 .../Controller/Plugin/AbstractRequestBase.php |  2 +-
 .../src/VuFind/Controller/Plugin/NewItems.php |  2 +-
 module/VuFind/src/VuFind/Cover/Generator.php  | 62 +++++++-------
 module/VuFind/src/VuFind/Crypt/RC4.php        |  6 +-
 .../src/VuFind/Db/Table/UserStatsFields.php   |  2 +-
 .../VuFind/Hierarchy/TreeRenderer/JSTree.php  |  2 +-
 .../VuFind/src/VuFind/ILS/Driver/Amicus.php   |  6 +-
 .../src/VuFind/ILS/Driver/ClaviusSQL.php      |  4 +-
 module/VuFind/src/VuFind/ILS/Driver/DAIA.php  |  8 +-
 module/VuFind/src/VuFind/ILS/Driver/Demo.php  | 66 +++++++--------
 .../VuFind/src/VuFind/ILS/Driver/Horizon.php  |  2 +-
 .../src/VuFind/ILS/Driver/HorizonXMLAPI.php   |  2 +-
 .../src/VuFind/ILS/Driver/Innovative.php      | 26 +++---
 module/VuFind/src/VuFind/ILS/Driver/LBS4.php  | 12 +--
 .../src/VuFind/ILS/Driver/NewGenLib.php       |  6 +-
 module/VuFind/src/VuFind/ILS/Driver/PICA.php  | 80 +++++++++----------
 .../VuFind/src/VuFind/ILS/Driver/Polaris.php  | 10 +--
 .../VuFind/src/VuFind/ILS/Driver/Sierra.php   |  4 +-
 .../VuFind/src/VuFind/ILS/Driver/Unicorn.php  |  2 +-
 .../VuFind/src/VuFind/ILS/Driver/Virtua.php   |  2 +-
 .../VuFind/src/VuFind/ILS/Driver/Voyager.php  |  6 +-
 .../src/VuFind/ILS/Driver/VoyagerRestful.php  |  6 +-
 module/VuFind/src/VuFind/OAI/Server.php       |  4 +-
 .../src/VuFind/Recommend/AuthorInfo.php       |  6 +-
 .../VuFind/Recommend/AuthorityRecommend.php   |  2 +-
 .../src/VuFind/Recommend/RandomRecommend.php  |  2 +-
 .../src/VuFind/Resolver/Driver/Redi.php       | 14 ++--
 .../VuFind/src/VuFind/Search/EIT/Options.php  |  1 -
 .../Search/Solr/AbstractErrorListener.php     |  1 -
 .../VuFind/Search/Solr/V4/ErrorListener.php   |  1 -
 module/VuFind/src/VuFind/SimpleXML.php        |  2 +-
 .../src/VuFind/Statistics/AbstractBase.php    |  2 +-
 .../src/VuFind/Statistics/Driver/Solr.php     |  2 +-
 .../VuFind/src/VuFind/Statistics/Record.php   |  4 +-
 .../VuFind/src/VuFind/Statistics/Search.php   |  4 +-
 .../src/VuFind/View/Helper/Root/Citation.php  |  2 +-
 .../src/VuFind/View/Helper/Root/Printms.php   | 10 +--
 .../VuFind/View/Helper/Root/ResultFeed.php    |  4 +-
 .../Config/Reader/CacheDecoratorTest.php      |  1 -
 .../src/VuFindTest/ILS/Driver/DAIATest.php    |  1 -
 .../ILS/Driver/MultiBackendTest.php           |  1 -
 .../VuFindTest/Resolver/Driver/RediTest.php   |  1 -
 module/VuFindSearch/Module.php                |  1 -
 .../Backend/AbstractHandlerMap.php            |  1 -
 .../src/VuFindSearch/Backend/EDS/Backend.php  |  2 +-
 .../Backend/EDS/SearchRequestModel.php        |  2 +-
 .../Backend/Solr/Document/CommitDocument.php  |  1 -
 .../Solr/Document/OptimizeDocument.php        |  1 -
 .../Backend/Solr/Document/UpdateDocument.php  |  1 -
 .../Backend/Solr/Response/Json/Record.php     |  1 -
 .../Response/RecordCollectionInterface.php    |  1 -
 .../VuFindSearch/Response/RecordInterface.php |  1 -
 .../Backend/AbstractHandlerMapTest.php        |  1 -
 .../VuFindTest/Backend/EDS/BackendTest.php    |  1 -
 .../VuFindTest/Backend/EIT/BackendTest.php    |  1 -
 .../src/VuFindTest/SearchServiceTest.php      |  3 +-
 .../src/VuFindTheme/LessCompiler.php          |  2 +-
 66 files changed, 210 insertions(+), 230 deletions(-)

diff --git a/module/VuDL/src/VuDL/Connection/AbstractBase.php b/module/VuDL/src/VuDL/Connection/AbstractBase.php
index 7c6b96e2007..1229a945f30 100644
--- a/module/VuDL/src/VuDL/Connection/AbstractBase.php
+++ b/module/VuDL/src/VuDL/Connection/AbstractBase.php
@@ -121,7 +121,7 @@ class AbstractBase implements \VuFindHttp\HttpServiceAwareInterface
         foreach ($detailsList as $key => $title) {
             $keys = explode(',', $key);
             $field = false;
-            for ($i = 0;$i<count($keys);$i++) {
+            for ($i = 0;$i < count($keys);$i++) {
                 if (isset($record[$keys[$i]])) {
                     $field = $keys[$i];
                     break;
diff --git a/module/VuDL/src/VuDL/Connection/Fedora.php b/module/VuDL/src/VuDL/Connection/Fedora.php
index dad33f9b19a..b2049bc1e8d 100644
--- a/module/VuDL/src/VuDL/Connection/Fedora.php
+++ b/module/VuDL/src/VuDL/Connection/Fedora.php
@@ -211,7 +211,7 @@ class Fedora extends AbstractBase
         $response = $this->query($query);
         $list = explode("\n", $response->getBody());
         $items = [];
-        for ($i = 1;$i<count($list);$i++) {
+        for ($i = 1;$i < count($list);$i++) {
             if (empty($list[$i])) {
                 continue;
             }
@@ -261,7 +261,7 @@ class Fedora extends AbstractBase
         if (count($list) > 2) {
             $items = [];
             $sequenced = true;
-            for ($i = 1;$i<count($list);$i++) {
+            for ($i = 1;$i < count($list);$i++) {
                 if (empty($list[$i])) {
                     continue;
                 }
@@ -280,7 +280,7 @@ class Fedora extends AbstractBase
                 usort(
                     $items,
                     function ($a, $b) {
-                        return intval($a['seq'])-intval($b['seq']);
+                        return intval($a['seq']) - intval($b['seq']);
                     }
                 );
                 return array_map(
@@ -301,7 +301,7 @@ class Fedora extends AbstractBase
         $response = $this->query($query);
         $list = explode("\n", $response->getBody());
         $items = [];
-        for ($i = 1;$i<count($list);$i++) {
+        for ($i = 1;$i < count($list);$i++) {
             if (empty($list[$i])) {
                 continue;
             }
@@ -335,7 +335,7 @@ class Fedora extends AbstractBase
         $response = $this->query($query);
         $list = explode("\n", trim($response->getBody(), "\n"));
         $tree = [];
-        for ($i = 1;$i<count($list);$i++) {
+        for ($i = 1;$i < count($list);$i++) {
             list($child, $parent, $title) = explode(',', substr($list[$i], 12), 3);
             $parent = substr($parent, 12);
             if (!isset($tree[$parent])) {
@@ -420,7 +420,7 @@ class Fedora extends AbstractBase
         if (count($data) > 1) {
             $bytes = intval($data[1]);
             $sizes = ['bytes','KB','MB'];
-            while ($size_index < count($sizes)-1 && $bytes > 1024) {
+            while ($size_index < count($sizes) - 1 && $bytes > 1024) {
                 $bytes /= 1024;
                 $size_index++;
             }
diff --git a/module/VuDL/src/VuDL/Controller/VudlController.php b/module/VuDL/src/VuDL/Controller/VudlController.php
index 8a8d834472b..a27897385e6 100644
--- a/module/VuDL/src/VuDL/Controller/VudlController.php
+++ b/module/VuDL/src/VuDL/Controller/VudlController.php
@@ -178,7 +178,7 @@ class VudlController extends AbstractVuDL
         $start = $this->params()->fromQuery('start');
         $end = $this->params()->fromQuery('end');
         $data = [
-            'outline' => $this->getOutline($id, $start, $end-$start),
+            'outline' => $this->getOutline($id, $start, $end - $start),
             'start'  => (int)$start
         ];
         $data['outline'] = current($data['outline']['lists']);
@@ -271,7 +271,7 @@ class VudlController extends AbstractVuDL
         // Get ids for all files
         $outline = $this->getOutline(
             $root,
-            max(0, $view->initPage-($this->getConnector()->getPageLength()/2))
+            max(0, $view->initPage - ($this->getConnector()->getPageLength() / 2))
         );
 
         // Send the data for the first pages
@@ -430,11 +430,11 @@ class VudlController extends AbstractVuDL
                 ->toRoute('collection', ['id' => $params['trail']]);
         } elseif (isset($params['prev'])) {
             return $this->redirect()->toRoute(
-                'vudl-record', ['id' => $members[($index-1)%count($members)]]
+                'vudl-record', ['id' => $members[($index - 1) % count($members)]]
             );
         } else {
             return $this->redirect()->toRoute(
-                'vudl-record', ['id' => $members[($index+1)%count($members)]]
+                'vudl-record', ['id' => $members[($index + 1) % count($members)]]
             );
         }
     }
diff --git a/module/VuFind/src/VuFind/Cart.php b/module/VuFind/src/VuFind/Cart.php
index 2e6b8d2195c..b4234148de0 100644
--- a/module/VuFind/src/VuFind/Cart.php
+++ b/module/VuFind/src/VuFind/Cart.php
@@ -163,7 +163,7 @@ class Cart
         $this->items = array_slice(array_unique($items), 0, $this->maxSize);
         $this->save();
         if ($total > $this->maxSize) {
-            $notAdded = $total-$this->maxSize;
+            $notAdded = $total - $this->maxSize;
             return ['success' => false, 'notAdded' => $notAdded];
         }
         return ['success' => true];
diff --git a/module/VuFind/src/VuFind/Config/Reader/CacheDecorator.php b/module/VuFind/src/VuFind/Config/Reader/CacheDecorator.php
index 86cd0917ada..894a7cade6e 100644
--- a/module/VuFind/src/VuFind/Config/Reader/CacheDecorator.php
+++ b/module/VuFind/src/VuFind/Config/Reader/CacheDecorator.php
@@ -42,7 +42,6 @@ use Zend\Cache\Storage\StorageInterface;
  */
 class CacheDecorator implements ReaderInterface
 {
-
     /**
      * The decorated reader.
      *
diff --git a/module/VuFind/src/VuFind/Controller/CollectionsController.php b/module/VuFind/src/VuFind/Controller/CollectionsController.php
index 34ad4f60962..0229d3b9339 100644
--- a/module/VuFind/src/VuFind/Controller/CollectionsController.php
+++ b/module/VuFind/src/VuFind/Controller/CollectionsController.php
@@ -198,7 +198,7 @@ class CollectionsController extends AbstractBase
             $key = 0;
         }
         if ($key >= count($result)) {
-            $key = count($result)-1;
+            $key = count($result) - 1;
         }
 
         // Begin building view model:
diff --git a/module/VuFind/src/VuFind/Controller/CoverController.php b/module/VuFind/src/VuFind/Controller/CoverController.php
index fbe772e559f..2f4b6c2cacb 100644
--- a/module/VuFind/src/VuFind/Controller/CoverController.php
+++ b/module/VuFind/src/VuFind/Controller/CoverController.php
@@ -132,7 +132,7 @@ class CoverController extends AbstractBase
         // is able to cache the cover images and not have to re-request
         // then on each page load. Default TTL set at 14 days
 
-        $coverImageTtl = (60*60*24*14); // 14 days
+        $coverImageTtl = (60 * 60 * 24 * 14); // 14 days
         $headers->addHeaderLine(
             'Cache-Control', "maxage=" . $coverImageTtl
         );
@@ -140,7 +140,7 @@ class CoverController extends AbstractBase
             'Pragma', 'public'
         );
         $headers->addHeaderLine(
-            'Expires', gmdate('D, d M Y H:i:s', time()+$coverImageTtl) . ' GMT'
+            'Expires', gmdate('D, d M Y H:i:s', time() + $coverImageTtl) . ' GMT'
         );
 
         $response->setContent($this->getLoader()->getImage());
diff --git a/module/VuFind/src/VuFind/Controller/HierarchyController.php b/module/VuFind/src/VuFind/Controller/HierarchyController.php
index ccf167ad5e9..bd00c3a4210 100644
--- a/module/VuFind/src/VuFind/Controller/HierarchyController.php
+++ b/module/VuFind/src/VuFind/Controller/HierarchyController.php
@@ -93,7 +93,7 @@ class HierarchyController extends AbstractBase
             ->get('VuFind\SearchResultsPluginManager')->get('Solr');
         $results->getParams()->setBasicSearch($lookfor, $searchType);
         $results->getParams()->addFilter('hierarchy_top_id:' . $hierarchyID);
-        $facets = $results->getFullFieldFacets(['id'], false, $limit+1);
+        $facets = $results->getFullFieldFacets(['id'], false, $limit + 1);
 
         $callback = function ($data) {
             return $data['value'];
diff --git a/module/VuFind/src/VuFind/Controller/MyResearchController.php b/module/VuFind/src/VuFind/Controller/MyResearchController.php
index 7f5329af3ce..a93693644b5 100644
--- a/module/VuFind/src/VuFind/Controller/MyResearchController.php
+++ b/module/VuFind/src/VuFind/Controller/MyResearchController.php
@@ -1218,7 +1218,7 @@ class MyResearchController extends AbstractBase
             $recoveryInterval = isset($config->Authentication->recover_interval)
                 ? $config->Authentication->recover_interval
                 : 60;
-            if (time()-$hashtime < $recoveryInterval) {
+            if (time() - $hashtime < $recoveryInterval) {
                 $this->flashMessenger()->setNamespace('error')
                     ->addMessage('recovery_too_soon');
             } else {
@@ -1270,7 +1270,7 @@ class MyResearchController extends AbstractBase
             $hashLifetime = isset($config->Authentication->recover_hash_lifetime)
                 ? $config->Authentication->recover_hash_lifetime
                 : 1209600; // Two weeks
-            if (time()-$hashtime > $hashLifetime) {
+            if (time() - $hashtime > $hashLifetime) {
                 $this->flashMessenger()->setNamespace('error')
                     ->addMessage('recovery_expired_hash');
                 return $this->forwardTo('MyResearch', 'Login');
diff --git a/module/VuFind/src/VuFind/Controller/Plugin/AbstractRequestBase.php b/module/VuFind/src/VuFind/Controller/Plugin/AbstractRequestBase.php
index d85f53f100e..d6853fe3338 100644
--- a/module/VuFind/src/VuFind/Controller/Plugin/AbstractRequestBase.php
+++ b/module/VuFind/src/VuFind/Controller/Plugin/AbstractRequestBase.php
@@ -299,7 +299,7 @@ abstract class AbstractRequestBase extends AbstractPlugin
     {
         list($d, $m, $y) = $dateArray;
         return mktime(
-            0, 0, 0, date('m')+$m, date('d')+$d, date('Y')+$y
+            0, 0, 0, date('m') + $m, date('d') + $d, date('Y') + $y
         );
     }
 }
diff --git a/module/VuFind/src/VuFind/Controller/Plugin/NewItems.php b/module/VuFind/src/VuFind/Controller/Plugin/NewItems.php
index 8620b4193b8..2a48d529744 100644
--- a/module/VuFind/src/VuFind/Controller/Plugin/NewItems.php
+++ b/module/VuFind/src/VuFind/Controller/Plugin/NewItems.php
@@ -78,7 +78,7 @@ class NewItems extends AbstractPlugin
 
         // Build a list of unique IDs
         $bibIDs = [];
-        for ($i = 0; $i<count($newItems['results']); $i++) {
+        for ($i = 0; $i < count($newItems['results']); $i++) {
             $bibIDs[] = $newItems['results'][$i]['id'];
         }
 
diff --git a/module/VuFind/src/VuFind/Cover/Generator.php b/module/VuFind/src/VuFind/Cover/Generator.php
index fdd3c3ee99c..b19128a5eb7 100644
--- a/module/VuFind/src/VuFind/Cover/Generator.php
+++ b/module/VuFind/src/VuFind/Cover/Generator.php
@@ -116,7 +116,7 @@ class Generator
      */
     protected function generateSolid($title, $author, $callnumber)
     {
-        $half = $this->settings->size/2;
+        $half = $this->settings->size / 2;
         // Create image
         if (!($im = imagecreate($this->settings->size, $this->settings->size))) {
             throw new \Exception("Cannot Initialize new GD image stream");
@@ -131,7 +131,7 @@ class Generator
         // Number to color, hsb to control saturation and lightness
         $color = $this->makeHSBColor(
             $im,
-            $seed%256,
+            $seed % 256,
             $this->settings->saturation,
             $this->settings->lightness
         );
@@ -150,7 +150,7 @@ class Generator
             $im,
             strtoupper($title[0]),
             $half,
-            $half+28,
+            $half + 28,
             $this->settings->titleFont,
             60,
             $this->white,
@@ -182,8 +182,8 @@ class Generator
     protected function generateGrid($title, $author, $callnumber)
     {
         // Set up common variables
-        $half = $this->settings->size/2;
-        $box  = $this->settings->size/8;
+        $half = $this->settings->size / 2;
+        $box  = $this->settings->size / 8;
 
         // Create image
         if (!($im = imagecreate($this->settings->size, $this->settings->size))) {
@@ -199,7 +199,7 @@ class Generator
         // Number to color, hsb to control saturation and lightness
         $grid_color = $this->makeHSBColor(
             $im,
-            $seed%256,
+            $seed % 256,
             $this->settings->saturation,
             $this->settings->lightness
         );
@@ -241,7 +241,7 @@ class Generator
         }
         if (null !== $callnumber) {
             $cv = 0;
-            for ($i = 0;$i<strlen($callnumber);$i++) {
+            for ($i = 0;$i < strlen($callnumber);$i++) {
                 $cv += ord($callnumber[$i]);
             }
             return $cv;
@@ -297,7 +297,7 @@ class Generator
         $line = '';
         $lineCount = 0;
         $i = 0;
-        while ($i<count($words) && $lineCount<$this->settings->maxLines-1) {
+        while ($i < count($words) && $lineCount < $this->settings->maxLines - 1) {
             $pline = $line;
             // Format
             $text = strtoupper($words[$i]);
@@ -313,7 +313,7 @@ class Generator
                     $im,
                     $pline,
                     3,
-                    $this->settings->topPadding+$lineHeight*$lineCount,
+                    $this->settings->topPadding + $lineHeight * $lineCount,
                     $this->settings->titleFont,
                     $this->settings->fontSize,
                     $this->black,
@@ -329,21 +329,21 @@ class Generator
             $im,
             $line,
             3,
-            $this->settings->topPadding+$lineHeight*$lineCount,
+            $this->settings->topPadding + $lineHeight * $lineCount,
             $this->settings->titleFont,
             $this->settings->fontSize,
             $this->black,
             $this->white
         );
         // Add ellipses if we've truncated
-        if ($i < count($words)-1) {
+        if ($i < count($words) - 1) {
             $this->drawText(
                 $im,
                 '...',
                 5,
-                $this->settings->topPadding+$this->settings->maxLines*$lineHeight,
+                $this->settings->topPadding + $this->settings->maxLines * $lineHeight,
                 $this->settings->titleFont,
-                $this->settings->fontSize+1,
+                $this->settings->fontSize + 1,
                 $this->black,
                 $this->white
             );
@@ -382,7 +382,7 @@ class Generator
             $im,
             $author,
             5,
-            $this->settings->size-3,
+            $this->settings->size - 3,
             $this->settings->authorFont,
             $fontSize,
             $this->white,
@@ -418,7 +418,7 @@ class Generator
     protected function textWidth($text, $font, $size)
     {
         $p = imagettfbbox($size, 0, $font, $text);
-        return $p[2]-$p[0]-4;
+        return $p[2] - $p[0] - 4;
     }
 
     /**
@@ -453,21 +453,21 @@ class Generator
         }
         if ($align == 'center') {
             $p = imagettfbbox($fontSize, 0, $this->settings->titleFont, $text);
-            $txtWidth = $p[2]-$p[0]-4;
-            $x = ($this->settings->size-$txtWidth)/2;
+            $txtWidth = $p[2] - $p[0] - 4;
+            $x = ($this->settings->size - $txtWidth) / 2;
         }
         if ($align == 'right') {
             $p = imagettfbbox($fontSize, 0, $this->settings->titleFont, $text);
-            $txtWidth = $p[2]-$p[0]-4;
-            $x = $this->settings->size-$txtWidth-$x;
+            $txtWidth = $p[2] - $p[0] - 4;
+            $x = $this->settings->size - $txtWidth - $x;
         }
 
         // Generate 5 lines of text, 4 offset in a border color
         if ($scolor) {
-            imagettftext($im, $fontSize, 0, $x,   $y+1, $scolor, $font, $text);
-            imagettftext($im, $fontSize, 0, $x,   $y-1, $scolor, $font, $text);
-            imagettftext($im, $fontSize, 0, $x+1, $y,   $scolor, $font, $text);
-            imagettftext($im, $fontSize, 0, $x-1, $y,   $scolor, $font, $text);
+            imagettftext($im, $fontSize, 0, $x,   $y + 1, $scolor, $font, $text);
+            imagettftext($im, $fontSize, 0, $x,   $y - 1, $scolor, $font, $text);
+            imagettftext($im, $fontSize, 0, $x + 1, $y,   $scolor, $font, $text);
+            imagettftext($im, $fontSize, 0, $x - 1, $y,   $scolor, $font, $text);
         }
         // 1 centered in main color
         imagettftext($im, $fontSize, 0, $x,   $y,   $mcolor, $font, $text);
@@ -488,18 +488,18 @@ class Generator
     protected function render($bc, $im, $color, $half, $box)
     {
         $bc = str_split($bc);
-        for ($k = 0;$k<4;$k++) {
-            $x = $k%2   ? $half : $half-$box;
-            $y = $k/2<1 ? $half : $half-$box;
-            $u = $k%2   ? $box : -$box;
-            $v = $k/2<1 ? $box : -$box;
-            for ($i = 0;$i<16;$i++) {
+        for ($k = 0;$k < 4;$k++) {
+            $x = $k % 2   ? $half : $half - $box;
+            $y = $k / 2 < 1 ? $half : $half - $box;
+            $u = $k % 2   ? $box : -$box;
+            $v = $k / 2 < 1 ? $box : -$box;
+            for ($i = 0;$i < 16;$i++) {
                 if ($bc[$i] == "1") {
-                    imagefilledrectangle($im, $x, $y, $x+$box-1, $y+$box-1, $color);
+                    imagefilledrectangle($im, $x, $y, $x + $box - 1, $y + $box - 1, $color);
                 }
                 $x += $u;
                 if ($x >= $this->settings->size || $x < 0) {
-                    $x = $k%2 ? $half : $half-$box;
+                    $x = $k % 2 ? $half : $half - $box;
                     $y += $v;
                 }
             }
diff --git a/module/VuFind/src/VuFind/Crypt/RC4.php b/module/VuFind/src/VuFind/Crypt/RC4.php
index b71cf8de8c1..655d4b01bd2 100644
--- a/module/VuFind/src/VuFind/Crypt/RC4.php
+++ b/module/VuFind/src/VuFind/Crypt/RC4.php
@@ -60,12 +60,12 @@ class RC4
          * Website: http://farhadi.ir/
          */
         $s = [];
-        for ($i = 0; $i<256; $i++) {
+        for ($i = 0; $i < 256; $i++) {
             $s[$i] = $i;
         }
         $j = 0;
         $x;
-        for ($i = 0; $i<256; $i++) {
+        for ($i = 0; $i < 256; $i++) {
             $j = ($j + $s[$i] + ord($key[$i % strlen($key)])) % 256;
             $x = $s[$i];
             $s[$i] = $s[$j];
@@ -75,7 +75,7 @@ class RC4
         $j = 0;
         $ct = '';
         $y;
-        for ($y = 0; $y<strlen($pt); $y++) {
+        for ($y = 0; $y < strlen($pt); $y++) {
             $i = ($i + 1) % 256;
             $j = ($j + $s[$i]) % 256;
             $x = $s[$i];
diff --git a/module/VuFind/src/VuFind/Db/Table/UserStatsFields.php b/module/VuFind/src/VuFind/Db/Table/UserStatsFields.php
index 0e04f258fa1..ae4d76f7fa7 100644
--- a/module/VuFind/src/VuFind/Db/Table/UserStatsFields.php
+++ b/module/VuFind/src/VuFind/Db/Table/UserStatsFields.php
@@ -96,7 +96,7 @@ class UserStatsFields extends Gateway
                 [$fields[0] => 'value']
             );
             $select->where->equalTo('field', $fields[0]);
-            for ($i = 1;$i<count($fields);$i++) {
+            for ($i = 1;$i < count($fields);$i++) {
                 $select->where->equalTo('field' . $i . '.field', $fields[$i]);
                 $select->join(
                     ['field' . $i => 'user_stats_fields'],
diff --git a/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/JSTree.php b/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/JSTree.php
index 9c01672cee4..29a558a92b3 100644
--- a/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/JSTree.php
+++ b/module/VuFind/src/VuFind/Hierarchy/TreeRenderer/JSTree.php
@@ -183,7 +183,7 @@ class JSTree extends AbstractBase
         ];
         if (isset($node->children)) {
             $ret['children'] = [];
-            for ($i = 0;$i<count($node->children);$i++) {
+            for ($i = 0;$i < count($node->children);$i++) {
                 $ret['children'][$i] = $this
                     ->buildNodeArray($node->children[$i], $context, $hierarchyID);
             }
diff --git a/module/VuFind/src/VuFind/ILS/Driver/Amicus.php b/module/VuFind/src/VuFind/ILS/Driver/Amicus.php
index ff02774fbc0..f67cf0541a0 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/Amicus.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/Amicus.php
@@ -495,7 +495,7 @@ class Amicus extends AbstractBase implements TranslatorAwareInterface
                     'duedate' => $this->sacaFecha($row['CPY_ID_NBR']),
                     // TODO: fill this in if you want "recently returned" support:
                     'returnDate' => false,
-                    'number' => count($data) +1,
+                    'number' => count($data) + 1,
                     'item_id' => $row['CPY_ID_NBR'],
                     'barcode' => $row['BRCDE_NBR']
                 ];
@@ -812,8 +812,8 @@ class Amicus extends AbstractBase implements TranslatorAwareInterface
 
         $page = ($page) ? $page : 1;
         $limit = ($limit) ? $limit : 20;
-        $startRow = (($page-1)*$limit)+1;
-        $endRow = ($page*$limit);
+        $startRow = (($page - 1) * $limit) + 1;
+        $endRow = ($page * $limit);
         $sql = "select * from " .
                "(select a.*, rownum rnum from " .
                "(select  CPY_ID.BIB_ITM_NBR  as BIB_ID, CPY_ID.CRTN_DTE " .
diff --git a/module/VuFind/src/VuFind/ILS/Driver/ClaviusSQL.php b/module/VuFind/src/VuFind/ILS/Driver/ClaviusSQL.php
index 94bc4b2f79d..251cdcd420f 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/ClaviusSQL.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/ClaviusSQL.php
@@ -236,7 +236,7 @@ class ClaviusSQL extends AbstractBase
       */
     public function getNewItems($page, $limit, $daysOld, $fundId = null)
     {
-        $limitFrom = ($page-1) * $limit;
+        $limitFrom = ($page - 1) * $limit;
         //TODO better escaping; mssql, oracle
         $sql = "SELECT t.tcislo as tcislo, t.druhdoku as druhdoku "
             . "FROM svazky s JOIN tituly t ON s.tcislo = t.tcislo "
@@ -436,7 +436,7 @@ class ClaviusSQL extends AbstractBase
                     'amount' => abs($fine['amount']),
                     'checkout' => null, // TODO maybe
                     'fine' => $reasons[$fine['reason']],
-                    'balance' => ($fine['amount']<0) ? abs($fine['amount']) : 0,
+                    'balance' => ($fine['amount'] < 0) ? abs($fine['amount']) : 0,
                     'createdate' => $fine['createdate'],
                     'duedate' => null, // TODO maybe
                     'id' => null,        // TODO maybe
diff --git a/module/VuFind/src/VuFind/ILS/Driver/DAIA.php b/module/VuFind/src/VuFind/ILS/Driver/DAIA.php
index 6d6cac9cdb2..699f8e2c2f2 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/DAIA.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/DAIA.php
@@ -551,7 +551,7 @@ class DAIA extends AbstractBase implements
                     $result_item["location"] = "Unknown";
                 }
                 // status and availability will be calculated in own function
-                $result_item = $this->calculateStatus($item)+$result_item;
+                $result_item = $this->calculateStatus($item) + $result_item;
                 // add result_item to the result array
                 $result[] = $result_item;
             } // end iteration on item
@@ -595,7 +595,7 @@ class DAIA extends AbstractBase implements
             $result = [
                 'callnumber' => '',
                 'availability' => '0',
-                'number' => ($c+1),
+                'number' => ($c + 1),
                 'reserve' => 'No',
                 'duedate' => '',
                 'queue'   => '',
@@ -930,7 +930,7 @@ class DAIA extends AbstractBase implements
                 $result = [
                     'callnumber' => '',
                     'availability' => '0',
-                    'number' => ($c+1),
+                    'number' => ($c + 1),
                     'reserve' => 'No',
                     'duedate' => '',
                     'queue'   => '',
@@ -1307,7 +1307,7 @@ class DAIA extends AbstractBase implements
                 'duedate'       => isset($earliest_duedate) ? $earliest_duedate : '',
                 'leanable'      => isset($leanable) ? $leanable : '',
                 'recallhref'    => isset($earliest_href) ? $earliest_href : '',
-                'number'        => ($c+1),
+                'number'        => ($c + 1),
                 'presenceOnly'  => isset($presenceOnly) ? $presenceOnly : '',
             ];
         }
diff --git a/module/VuFind/src/VuFind/ILS/Driver/Demo.php b/module/VuFind/src/VuFind/ILS/Driver/Demo.php
index 063ba088de1..5819af091f7 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/Demo.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/Demo.php
@@ -148,7 +148,7 @@ class Demo extends AbstractBase
     protected function getFakeLoc($returnText = true)
     {
         $locations = $this->getPickUpLocations();
-        $loc = rand()%count($locations);
+        $loc = rand() % count($locations);
         return $returnText
             ? $locations[$loc]['locationDisplay']
             : $locations[$loc]['locationID'];
@@ -161,7 +161,7 @@ class Demo extends AbstractBase
      */
     protected function getFakeStatus()
     {
-        $loc = rand()%10;
+        $loc = rand() % 10;
         switch ($loc) {
         case 10:
             return "Missing";
@@ -182,9 +182,9 @@ class Demo extends AbstractBase
     protected function getFakeCallNum()
     {
         $codes = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-        $a = $codes[rand()%strlen($codes)];
-        $b = rand()%899 + 100;
-        $c = rand()%9999;
+        $a = $codes[rand() % strlen($codes)];
+        $b = rand() % 899 + 100;
+        $c = rand() % 9999;
         return $a . $b . "." . $c;
     }
 
@@ -233,23 +233,23 @@ class Demo extends AbstractBase
             'source'       => $this->getRecordSource(),
             'item_id'      => $number,
             'number'       => $number,
-            'barcode'      => sprintf("%08d", rand()%50000),
+            'barcode'      => sprintf("%08d", rand() % 50000),
             'availability' => $status == 'Available',
             'status'       => $status,
             'location'     => $this->getFakeLoc(),
-            'reserve'      => (rand()%100 > 49) ? 'Y' : 'N',
+            'reserve'      => (rand() % 100 > 49) ? 'Y' : 'N',
             'callnumber'   => $this->getFakeCallNum(),
             'duedate'      => '',
             'is_holdable'  => true,
-            'addLink'      => $patron ? rand()%10 == 0 ? 'block' : true : false,
+            'addLink'      => $patron ? rand() % 10 == 0 ? 'block' : true : false,
             'level'        => 'copy',
             'storageRetrievalRequest' => 'auto',
             'addStorageRetrievalRequestLink' => $patron
-                ? rand()%10 == 0 ? 'block' : 'check'
+                ? rand() % 10 == 0 ? 'block' : 'check'
                 : false,
             'ILLRequest'   => 'auto',
             'addILLRequestLink' => $patron
-                ? rand()%10 == 0 ? 'block' : 'check'
+                ? rand() % 10 == 0 ? 'block' : 'check'
                 : false
         ];
     }
@@ -285,7 +285,7 @@ class Demo extends AbstractBase
     {
         // How many items are there?  %10 - 1 = 10% chance of none,
         // 90% of 1-9 (give or take some odd maths)
-        $items = rand()%10 - 1;
+        $items = rand() % 10 - 1;
 
         $requestGroups = $this->getRequestGroups(null, null);
 
@@ -303,7 +303,7 @@ class Demo extends AbstractBase
             ];
             // Inject a random identifier of some sort:
             $currentItem += $this->getRandomItemIdentifier();
-            if ($i == 2 || rand()%5 == 1) {
+            if ($i == 2 || rand() % 5 == 1) {
                 // Mimic an ILL request
                 $currentItem["id"] = "ill_request_$i";
                 $currentItem["title"] = "ILL Hold Title $i";
@@ -320,7 +320,7 @@ class Demo extends AbstractBase
             }
 
             if ($requestType == 'Holds') {
-                $pos = rand()%5;
+                $pos = rand() % 5;
                 if ($pos > 1) {
                     $currentItem['position'] = $pos;
                 } else {
@@ -329,14 +329,14 @@ class Demo extends AbstractBase
                 $pos = rand(0, count($requestGroups) - 1);
                 $currentItem['requestGroup'] = $requestGroups[$pos]['name'];
             } else {
-                $status = rand()%5;
+                $status = rand() % 5;
                 $currentItem['available'] = $status == 1;
                 $currentItem['canceled'] = $status == 2;
                 $currentItem['processed'] = ($status == 1 || rand(1, 3) == 3)
                     ? date("j-M-y")
                     : '';
                 if ($requestType == 'ILLRequests') {
-                    $transit = rand()%2;
+                    $transit = rand() % 2;
                     if (!$currentItem['available']
                         && !$currentItem['canceled']
                         && $transit == 1
@@ -385,7 +385,7 @@ class Demo extends AbstractBase
     {
         $id = $id . ""; // make it a string for consistency
         // How many items are there?
-        $records = rand()%15;
+        $records = rand() % 15;
         $holding = [];
 
         // NOTE: Ran into an interesting bug when using:
@@ -405,7 +405,7 @@ class Demo extends AbstractBase
 
         // Create a fake entry for each one
         for ($i = 0; $i < $records; $i++) {
-            $holding[] = $this->getRandomHolding($id, $i+1, $patron);
+            $holding[] = $this->getRandomHolding($id, $i + 1, $patron);
         }
         return $holding;
     }
@@ -424,7 +424,7 @@ class Demo extends AbstractBase
     public function setStatus($id, $holding = [], $append = true)
     {
         $id = (string)$id;
-        $i = ($this->session->statuses) ? count($this->session->statuses)+1 : 1;
+        $i = ($this->session->statuses) ? count($this->session->statuses) + 1 : 1;
         $holding = array_merge($this->getRandomHolding($id, $i), $holding);
 
         // if statuses is already stored
@@ -635,14 +635,14 @@ class Demo extends AbstractBase
         if (!isset($this->session->fines)) {
             // How many items are there? %20 - 2 = 10% chance of none,
             // 90% of 1-18 (give or take some odd maths)
-            $fines = rand()%20 - 2;
+            $fines = rand() % 20 - 2;
 
             $fineList = [];
             for ($i = 0; $i < $fines; $i++) {
                 // How many days overdue is the item?
-                $day_overdue = rand()%30 + 5;
+                $day_overdue = rand() % 30 + 5;
                 // Calculate checkout date:
-                $checkout = strtotime("now - " . ($day_overdue+14) . " days");
+                $checkout = strtotime("now - " . ($day_overdue + 14) . " days");
                 // 50c a day fine?
                 $fine = $day_overdue * 0.50;
 
@@ -652,7 +652,7 @@ class Demo extends AbstractBase
                     // After 20 days it becomes 'Long Overdue'
                     "fine"     => $day_overdue > 20 ? "Long Overdue" : "Overdue",
                     // 50% chance they've paid half of it
-                    "balance"  => (rand()%100 > 49 ? $fine/2 : $fine) * 100,
+                    "balance"  => (rand() % 100 > 49 ? $fine / 2 : $fine) * 100,
                     "duedate"  =>
                         date("j-M-y", strtotime("now - $day_overdue days"))
                 ];
@@ -747,12 +747,12 @@ class Demo extends AbstractBase
         if (!isset($this->session->transactions)) {
             // How many items are there?  %10 - 1 = 10% chance of none,
             // 90% of 1-9 (give or take some odd maths)
-            $trans = rand()%10 - 1;
+            $trans = rand() % 10 - 1;
 
             $transList = [];
             for ($i = 0; $i < $trans; $i++) {
                 // When is it due? +/- up to 15 days
-                $due_relative = rand()%30 - 15;
+                $due_relative = rand() % 30 - 15;
                 // Due date
                 $dueStatus = false;
                 if ($due_relative >= 0) {
@@ -766,26 +766,26 @@ class Demo extends AbstractBase
                 }
 
                 // Times renewed    : 0,0,0,0,0,1,2,3,4,5
-                $renew = rand()%10 - 5;
+                $renew = rand() % 10 - 5;
                 if ($renew < 0) {
                     $renew = 0;
                 }
 
                 // Renewal limit
-                $renewLimit = $renew + rand()%3;
+                $renewLimit = $renew + rand() % 3;
 
                 // Pending requests : 0,0,0,0,0,1,2,3,4,5
-                $req = rand()%10 - 5;
+                $req = rand() % 10 - 5;
                 if ($req < 0) {
                     $req = 0;
                 }
 
-                if ($i == 2 || rand()%5 == 1) {
+                if ($i == 2 || rand() % 5 == 1) {
                     // Mimic an ILL loan
                     $transList[] = $this->getRandomItemIdentifier() + [
                         'duedate' => $due_date,
                         'dueStatus' => $dueStatus,
-                        'barcode' => sprintf("%08d", rand()%50000),
+                        'barcode' => sprintf("%08d", rand() % 50000),
                         'renew'   => $renew,
                         'renewLimit' => $renewLimit,
                         'request' => $req,
@@ -802,7 +802,7 @@ class Demo extends AbstractBase
                     $transList[] = $this->getRandomItemIdentifier() + [
                         'duedate' => $due_date,
                         'dueStatus' => $dueStatus,
-                        'barcode' => sprintf("%08d", rand()%50000),
+                        'barcode' => sprintf("%08d", rand() % 50000),
                         'renew'   => $renew,
                         'renewLimit' => $renewLimit,
                         'request' => $req,
@@ -875,7 +875,7 @@ class Demo extends AbstractBase
     {
         // 5 years in the future (but similate intermittent failure):
         return rand(0, 1) == 1
-            ? mktime(0, 0, 0, date('m'), date('d'), date('Y')+5) : null;
+            ? mktime(0, 0, 0, date('m'), date('d'), date('Y') + 5) : null;
     }
 
     /**
@@ -1472,7 +1472,7 @@ class Demo extends AbstractBase
                 'location' => $details['pickUpLocation'],
                 'expire'   => date('j-M-y', $expire),
                 'create'  => date('j-M-y'),
-                'processed' => rand()%3 == 0 ? date('j-M-y', $expire) : '',
+                'processed' => rand() % 3 == 0 ? date('j-M-y', $expire) : '',
                 'reqnum'   => sprintf('%06d', $nextId),
                 'item_id'  => $nextId
             ]
@@ -1591,7 +1591,7 @@ class Demo extends AbstractBase
                 'location' => $pickupLocation,
                 'expire'   => date('j-M-y', $expire),
                 'create'  => date('j-M-y'),
-                'processed' => rand()%3 == 0 ? date('j-M-y', $expire) : '',
+                'processed' => rand() % 3 == 0 ? date('j-M-y', $expire) : '',
                 'reqnum'   => sprintf('%06d', $nextId),
                 'item_id'  => $nextId
             ]
diff --git a/module/VuFind/src/VuFind/ILS/Driver/Horizon.php b/module/VuFind/src/VuFind/ILS/Driver/Horizon.php
index 18abd094605..d7a0ac78c40 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/Horizon.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/Horizon.php
@@ -909,7 +909,7 @@ class Horizon extends AbstractBase
             if (is_numeric($dueTimeStamp)) {
                 if ($now > $dueTimeStamp) {
                     $dueStatus = "overdue";
-                } else if ($now > $dueTimeStamp-(1*24*60*60)) {
+                } else if ($now > $dueTimeStamp - (1 * 24 * 60 * 60)) {
                     $dueStatus = "due";
                 }
             }
diff --git a/module/VuFind/src/VuFind/ILS/Driver/HorizonXMLAPI.php b/module/VuFind/src/VuFind/ILS/Driver/HorizonXMLAPI.php
index 560fe47f0e5..8eabb2c6a68 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/HorizonXMLAPI.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/HorizonXMLAPI.php
@@ -651,7 +651,7 @@ class HorizonXMLAPI extends Horizon implements \VuFindHttp\HttpServiceAwareInter
                         'success' => true, 'status' => "hold_cancel_success",
 
                     ];
-                    $count = $count+1;
+                    $count = $count + 1;
                 }
             }
         } else {
diff --git a/module/VuFind/src/VuFind/ILS/Driver/Innovative.php b/module/VuFind/src/VuFind/ILS/Driver/Innovative.php
index 9be05c3728b..29a3b1293fb 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/Innovative.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/Innovative.php
@@ -144,7 +144,7 @@ class Innovative extends AbstractBase implements
         // '<table class="bibItems" '
         $r = substr($result, stripos($result, 'bibItems'));
         // strip out the rest of the first table tag.
-        $r = substr($r, strpos($r, ">")+1);
+        $r = substr($r, strpos($r, ">") + 1);
         // strip out the next table closing tag and everything after it.
         $r = substr($r, 0, stripos($r, "</table"));
 
@@ -189,28 +189,28 @@ class Innovative extends AbstractBase implements
                 } else if ($count > 1) { // not the first row, has holding info
                     //look for location column
                     if (stripos($keys[$i], $loc_col_name) > -1) {
-                        $ret[$count-2]['location'] = strip_tags($cols[$i]);
+                        $ret[$count - 2]['location'] = strip_tags($cols[$i]);
                     }
                     // Does column hold reserves information?
                     if (stripos($keys[$i], $reserves_col_name) > -1) {
                         if (stripos($cols[$i], $reserves_key_name) > -1) {
-                            $ret[$count-2]['reserve'] = 'Y';
+                            $ret[$count - 2]['reserve'] = 'Y';
                         } else {
-                            $ret[$count-2]['reserve'] = 'N';
+                            $ret[$count - 2]['reserve'] = 'N';
                         }
                     }
                     // Does column hold call numbers?
                     if (stripos($keys[$i], $call_col_name) > -1) {
-                        $ret[$count-2]['callnumber'] = strip_tags($cols[$i]);
+                        $ret[$count - 2]['callnumber'] = strip_tags($cols[$i]);
                     }
                     // Look for status information.
                     if (stripos($keys[$i], $status_col_name) > -1) {
                         if (stripos($cols[$i], $stat_avail) > -1) {
-                            $ret[$count-2]['status'] = "Available On Shelf";
-                            $ret[$count-2]['availability'] = 1;
+                            $ret[$count - 2]['status'] = "Available On Shelf";
+                            $ret[$count - 2]['availability'] = 1;
                         } else {
-                            $ret[$count-2]['status'] = "Available to request";
-                            $ret[$count-2]['availability'] = 0;
+                            $ret[$count - 2]['status'] = "Available to request";
+                            $ret[$count - 2]['availability'] = 0;
                         }
                         if (stripos($cols[$i], $stat_due) > -1) {
                             $t = trim(
@@ -220,17 +220,17 @@ class Innovative extends AbstractBase implements
                                 )
                             );
                             $t = substr($t, 0, stripos($t, " "));
-                            $ret[$count-2]['duedate'] = $t;
+                            $ret[$count - 2]['duedate'] = $t;
                         }
                     }
                     //$ret[$count-2][$keys[$i]] = $cols[$i];
                     //$ret[$count-2]['id'] = $bibid;
-                    $ret[$count-2]['id'] = $id;
-                    $ret[$count-2]['number'] = ($count -1);
+                    $ret[$count - 2]['id'] = $id;
+                    $ret[$count - 2]['number'] = ($count - 1);
                     // Return a fake barcode so hold link is enabled
                     // TODO: Should be dependent on settings variable, if bib level
                     // holds.
-                    $ret[$count-2]['barcode'] = '1234567890123';
+                    $ret[$count - 2]['barcode'] = '1234567890123';
                 }
             }
             $count++;
diff --git a/module/VuFind/src/VuFind/ILS/Driver/LBS4.php b/module/VuFind/src/VuFind/ILS/Driver/LBS4.php
index eb46d9fabf9..a1a580c8c8e 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/LBS4.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/LBS4.php
@@ -284,7 +284,7 @@ class LBS4 extends AbstractBase implements TranslatorAwareInterface
                     $available = false;
                     $duedate = $this->getLoanexpire($volnum);
                     $is_holdable = true;
-                } else if ($loan_indi>6) {
+                } else if ($loan_indi > 6) {
                     $available = false;
                 }
 
@@ -757,7 +757,7 @@ class LBS4 extends AbstractBase implements TranslatorAwareInterface
             while ($row = sybase_fetch_row($sqlStmt)) {
                 //$fine = $this->translate(('3'==$row[1])?'Overdue':'Dues');
                 $fine = $this->picaRecode($row[5]);
-                $amount = (null == $row[2]) ? 0 : $row[2]*100;
+                $amount = (null == $row[2]) ? 0 : $row[2] * 100;
                 //$balance = (null==$row[3])?0:$row[3]*100;
                 $checkout = substr($row[3], 0,  12);
                 $duedate = substr($row[4], 0, 12);
@@ -804,13 +804,13 @@ class LBS4 extends AbstractBase implements TranslatorAwareInterface
     {
         $x = 0; $y = 0; $w = 2;
         $stra = str_split($str);
-        for ($i = strlen($str); $i>0; $i--) {
-            $c = $stra[$i-1];
+        for ($i = strlen($str); $i > 0; $i--) {
+            $c = $stra[$i - 1];
             $x = ord($c) - 48;
-            $y += $x*$w;
+            $y += $x * $w;
             $w++;
         }
-        $p = 11-$y%11;
+        $p = 11 - $y % 11;
         if ($p == 11) {
             $p = 0;
         }
diff --git a/module/VuFind/src/VuFind/ILS/Driver/NewGenLib.php b/module/VuFind/src/VuFind/ILS/Driver/NewGenLib.php
index 11850d4ebe0..f20cae94cb7 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/NewGenLib.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/NewGenLib.php
@@ -157,7 +157,7 @@ class NewGenLib extends AbstractBase
         $id = "";
         while ($row = $sqlStmt->fetch(PDO::FETCH_ASSOC)) {
             $id = $row['cataloguerecordid'] . "_" . $row['owner_library_id'];
-            $amount = $row['fine_amt']*100;
+            $amount = $row['fine_amt'] * 100;
             $checkout = $row['ta_date'];
             $duedate = $row['due_date'];
             $paidamtsql = "select sum(f.fine_amt_paid) as fine_amt_paid from " .
@@ -172,8 +172,8 @@ class NewGenLib extends AbstractBase
             $paidamt = "";
             $balance = "";
             while ($rowpaid = $sqlStmt1->fetch(PDO::FETCH_ASSOC)) {
-                $paidamt = $rowpaid['fine_amt_paid']*100;
-                $balance = $amount-$paidamt;
+                $paidamt = $rowpaid['fine_amt_paid'] * 100;
+                $balance = $amount - $paidamt;
             }
 
             $MyFines[] = ['amount' => $amount,
diff --git a/module/VuFind/src/VuFind/ILS/Driver/PICA.php b/module/VuFind/src/VuFind/ILS/Driver/PICA.php
index 33e72f325e6..2db621e19e6 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/PICA.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/PICA.php
@@ -180,10 +180,10 @@ class PICA extends DAIA
         if ($messages === 2) {
             // ignore the first message (its only the message to close the window
             // after finishing)
-            for ($n = 0; $n<2; $n++) {
+            for ($n = 0; $n < 2; $n++) {
                 $pos = strpos($postit, '<strong class="alert">', $position);
                 $pos_close = strpos($postit, '</strong>', $pos);
-                $value = substr($postit, $pos+22, ($pos_close-$pos-22));
+                $value = substr($postit, $pos + 22, ($pos_close - $pos - 22));
                 $position = $pos + 1;
             }
             $recordList['message'] = $value;
@@ -228,17 +228,17 @@ class PICA extends DAIA
             $position = strpos($postit, '<iframe');
             for ($i = 0; $i < $iframes; $i++) {
                 $pos = strpos($postit, 'VBAR=', $position);
-                $value = substr($postit, $pos+9, 8);
-                $completeValue = substr($postit, $pos+5, 12);
+                $value = substr($postit, $pos + 9, 8);
+                $completeValue = substr($postit, $pos + 5, 12);
                 $barcode[] = $completeValue;
                 $bc = $this->getPpnByBarcode($value);
                 $ppns[] = $bc;
                 $position = $pos + 1;
                 $current_position = $position;
                 $position_state = null;
-                for ($n = 0; $n<6; $n++) {
+                for ($n = 0; $n < 6; $n++) {
                     $current_position = $this->strposBackwards(
-                        $postit, '<td class="value-small">', $current_position-1
+                        $postit, '<td class="value-small">', $current_position - 1
                     );
                     if ($n === 1) {
                         $position_reservations = $current_position;
@@ -254,15 +254,15 @@ class PICA extends DAIA
                     }
                 }
                 if ($position_state !== null
-                    && substr($postit, $position_state+24, 8) !== 'bestellt'
+                    && substr($postit, $position_state + 24, 8) !== 'bestellt'
                 ) {
-                    $reservations[] = substr($postit, $position_reservations+24, 1);
-                    $expiration[] = substr($postit, $position_expire+24, 10);
+                    $reservations[] = substr($postit, $position_reservations + 24, 1);
+                    $expiration[] = substr($postit, $position_expire + 24, 10);
                     $renewals[] = $this->getRenewals($completeValue);
                     $closing_title = strpos($postit, '</td>', $position_title);
                     $titles[] = $completeValue . " " . substr(
-                        $postit, $position_title+24,
-                        ($closing_title-$position_title-24)
+                        $postit, $position_title + 24,
+                        ($closing_title - $position_title - 24)
                     );
                 } else {
                     $holdsByIframe--;
@@ -278,18 +278,18 @@ class PICA extends DAIA
             $position = strpos($postit, 'input type="checkbox" name="VB"');
             for ($i = 0; $i < $holds; $i++) {
                 $pos = strpos($postit, 'value=', $position);
-                $value = substr($postit, $pos+11, 8);
-                $completeValue = substr($postit, $pos+7, 12);
+                $value = substr($postit, $pos + 11, 8);
+                $completeValue = substr($postit, $pos + 7, 12);
                 $barcode[] = $completeValue;
                 $ppns[] = $this->getPpnByBarcode($value);
                 $position = $pos + 1;
                 $position_expire = $position;
-                for ($n = 0; $n<4; $n++) {
+                for ($n = 0; $n < 4; $n++) {
                     $position_expire = strpos(
-                        $postit, '<td class="value-small">', $position_expire+1
+                        $postit, '<td class="value-small">', $position_expire + 1
                     );
                 }
-                $expiration[] = substr($postit, $position_expire+24, 10);
+                $expiration[] = substr($postit, $position_expire + 24, 10);
                 $renewals[] = $this->getRenewals($completeValue);
             }
         }
@@ -338,9 +338,9 @@ class PICA extends DAIA
         $needle_reverse = strrev($needle);
         $position_brutto = strpos($haystack_reverse, $needle_reverse);
         if ($offset === 0) {
-            $position_netto = strlen($haystack)-$position_brutto-strlen($needle);
+            $position_netto = strlen($haystack) - $position_brutto - strlen($needle);
         } else {
-            $position_netto = $offset-$position_brutto-strlen($needle);
+            $position_netto = $offset - $position_brutto - strlen($needle);
         }
         return $position_netto;
     }
@@ -427,7 +427,7 @@ class PICA extends DAIA
         $postit = $this->postit($URL, $POST);
 
         // How many items are there?
-        $holds = substr_count($postit, '<td class="plain"')/3;
+        $holds = substr_count($postit, '<td class="plain"') / 3;
         $fineDate = [];
         $description = [];
         $fine = [];
@@ -437,17 +437,17 @@ class PICA extends DAIA
             // first class=plain => description
             // length = position of next </td> - startposition
             $nextClosingTd = strpos($postit, '</td>', $pos);
-            $description[$i] = substr($postit, $pos+18, ($nextClosingTd-$pos-18));
+            $description[$i] = substr($postit, $pos + 18, ($nextClosingTd - $pos - 18));
             $position = $pos + 1;
             // next class=plain => date of fee creation
             $pos = strpos($postit, '<td class="plain"', $position);
             $nextClosingTd = strpos($postit, '</td>', $pos);
-            $fineDate[$i] = substr($postit, $pos+18, ($nextClosingTd-$pos-18));
+            $fineDate[$i] = substr($postit, $pos + 18, ($nextClosingTd - $pos - 18));
             $position = $pos + 1;
             // next class=plain => amount of fee
             $pos = strpos($postit, '<td class="plain"', $position);
             $nextClosingTd = strpos($postit, '</td>', $pos);
-            $fineString = substr($postit, $pos+32, ($nextClosingTd-$pos-32));
+            $fineString = substr($postit, $pos + 32, ($nextClosingTd - $pos - 32));
             $feeString = explode(',', $fineString);
             $feeString[1] = substr($feeString[1], 0, 2);
             $fine[$i] = (double) implode('', $feeString);
@@ -500,17 +500,17 @@ class PICA extends DAIA
         $position = strpos($postit, 'input type="checkbox" name="VB"');
         for ($i = 0; $i < $holds; $i++) {
             $pos = strpos($postit, 'value=', $position);
-            $value = substr($postit, $pos+11, 8);
+            $value = substr($postit, $pos + 11, 8);
             $ppns[] = $this->getPpnByBarcode($value);
             $position = $pos + 1;
             $position_create = $position;
-            for ($n = 0; $n<3; $n++) {
+            for ($n = 0; $n < 3; $n++) {
                 $position_create = strpos(
-                    $postit, '<td class="value-small">', $position_create+1
+                    $postit, '<td class="value-small">', $position_create + 1
                 );
             }
             $creation[]
-                = str_replace('-', '.', substr($postit, $position_create+24, 10));
+                = str_replace('-', '.', substr($postit, $position_create + 24, 10));
         }
         /* items, which are ordered and have no signature yet, are not included in
          * the for-loop getthem by checkbox PPN
@@ -520,32 +520,32 @@ class PICA extends DAIA
         for ($i = 0; $i < $moreholds; $i++) {
             $pos = strpos($postit, 'value=', $position);
             // get the length of PPN
-               $x = strpos($postit, '"', $pos+7);
-            $value = substr($postit, $pos+7, $x-$pos-7);
+               $x = strpos($postit, '"', $pos + 7);
+            $value = substr($postit, $pos + 7, $x - $pos - 7);
             // problem: the value presented here does not contain the checksum!
             // so its not a valid identifier
             // we need to calculate the checksum
             $checksum = 0;
-            for ($i = 0; $i<strlen($value);$i++) {
-                $checksum += $value[$i]*(9-$i);
+            for ($i = 0; $i < strlen($value);$i++) {
+                $checksum += $value[$i] * (9 - $i);
             }
-            if ($checksum%11 === 1) {
+            if ($checksum % 11 === 1) {
                 $checksum = 'X';
-            } else if ($checksum%11 === 0) {
+            } else if ($checksum % 11 === 0) {
                 $checksum = 0;
             } else {
-                $checksum = 11 - $checksum%11;
+                $checksum = 11 - $checksum % 11;
             }
             $ppns[] = $value . $checksum;
             $position = $pos + 1;
             $position_create = $position;
-            for ($n = 0; $n<3; $n++) {
+            for ($n = 0; $n < 3; $n++) {
                 $position_create = strpos(
-                    $postit, '<td class="value-small">', $position_create+1
+                    $postit, '<td class="value-small">', $position_create + 1
                 );
             }
             $creation[]
-                = str_replace('-', '.', substr($postit, $position_create+24, 10));
+                = str_replace('-', '.', substr($postit, $position_create + 24, 10));
         }
 
         /* media ordered from closed stack is not visible on the UI_LOR page
@@ -565,16 +565,16 @@ class PICA extends DAIA
         $position = 0;
         for ($i = 0; $i < $requests; $i++) {
             $position = strpos(
-                $postit_lol, '<td class="value-small">bestellt</td>', $position+1
+                $postit_lol, '<td class="value-small">bestellt</td>', $position + 1
             );
-            $pos = strpos($postit_lol, '<td class="value-small">', ($position-100));
+            $pos = strpos($postit_lol, '<td class="value-small">', ($position - 100));
             $nextClosingTd = strpos($postit_lol, '</td>', $pos);
-            $value = substr($postit_lol, $pos+27, ($nextClosingTd-$pos-27));
+            $value = substr($postit_lol, $pos + 27, ($nextClosingTd - $pos - 27));
             $ppns[] = $this->getPpnByBarcode($value);
             $creation[] = date('d.m.Y');
         }
 
-        for ($i = 0; $i < ($holds+$moreholds+$requests); $i++) {
+        for ($i = 0; $i < ($holds + $moreholds + $requests); $i++) {
             $holdList[] = [
                 "id"       => $ppns[$i],
                 "create"   => $creation[$i]
diff --git a/module/VuFind/src/VuFind/ILS/Driver/Polaris.php b/module/VuFind/src/VuFind/ILS/Driver/Polaris.php
index 5b6d8477b21..b3fcc092f28 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/Polaris.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/Polaris.php
@@ -181,7 +181,7 @@ class Polaris extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterf
     {
         preg_match('/Date\((\d+)\-(\d){2}(\d){2}\)/', $jsontime, $matches);
         if (count($matches) > 0) {
-            $matchestmp = intval($matches[1]/1000);
+            $matchestmp = intval($matches[1] / 1000);
             $date = date("n-j-Y", $matchestmp);
         } else {
             $date = 'n/a';
@@ -618,10 +618,10 @@ class Polaris extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterf
         foreach ($fines_response_array as $fines_response) {
             $fineList[] = [
             // fees in vufind are in pennies
-            'amount'   => $fines_response->TransactionAmount*100,
+            'amount'   => $fines_response->TransactionAmount * 100,
             'checkout' => $this->formatJSONTime($fines_response->CheckOutDate),
             'fine'     => $fines_response->FeeDescription,
-            'balance'  => $fines_response->OutstandingAmount*100,
+            'balance'  => $fines_response->OutstandingAmount * 100,
             'duedate'    => $this->formatJSONTime($fines_response->DueDate),
             'createdate' => $this->formatJSONTime($fines_response->TransactionDate),
             'id'    => $fines_response->BibID,
@@ -863,10 +863,10 @@ class Polaris extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterf
             return;
         }
 
-        $offset = $count-$items_per_page;
+        $offset = $count - $items_per_page;
         $pages = ceil($count / $items_per_page);
 
-        $penultimate_page = $pages-1;
+        $penultimate_page = $pages - 1;
 
         if ($penultimate_page > 0) {
             $page_offset = $penultimate_page;
diff --git a/module/VuFind/src/VuFind/ILS/Driver/Sierra.php b/module/VuFind/src/VuFind/ILS/Driver/Sierra.php
index 56f982f2290..0f4ea099fdb 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/Sierra.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/Sierra.php
@@ -82,7 +82,7 @@ class Sierra extends AbstractBase implements TranslatorAwareInterface
         // see Millennium manual page #105781 for the logic behind this
         for ($i = $numberLength; $i > 0; $i--) {
             $j = $numberLength - $i;
-            $partialCheck = $partialCheck + ($digitArray[$j] * ($i+1));
+            $partialCheck = $partialCheck + ($digitArray[$j] * ($i + 1));
         }
         $checkdigit = $partialCheck % 11;
         if ($checkdigit == 10) {
@@ -133,7 +133,7 @@ class Sierra extends AbstractBase implements TranslatorAwareInterface
         }
 
         // Convert hours to seconds:
-        $seconds = 60*60*$this->config['Catalog']['just_cataloged_time'];
+        $seconds = 60 * 60 * $this->config['Catalog']['just_cataloged_time'];
 
         // Was this a recently cataloged item? If so, return a special string
         // based on the append setting....
diff --git a/module/VuFind/src/VuFind/ILS/Driver/Unicorn.php b/module/VuFind/src/VuFind/ILS/Driver/Unicorn.php
index 462d71b3185..e1ed0fc43dd 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/Unicorn.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/Unicorn.php
@@ -1011,7 +1011,7 @@ class Unicorn extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterf
             $rescount++;
         }
 
-        $results = array_slice($items, ($page - 1) * $limit, ($page * $limit)-1);
+        $results = array_slice($items, ($page - 1) * $limit, ($page * $limit) - 1);
         return ['count' => $rescount, 'results' => $results];
     }
 
diff --git a/module/VuFind/src/VuFind/ILS/Driver/Virtua.php b/module/VuFind/src/VuFind/ILS/Driver/Virtua.php
index 871d4812416..2d1fca44cdb 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/Virtua.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/Virtua.php
@@ -1720,7 +1720,7 @@ class Virtua extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterfa
         //consortium&amp;conf=.%26%23047%3bchameleon.conf&amp;timedout=1" />
         $start = strpos($result, 'sessionid=') + 10;
         $end   = strpos($result, '&amp;skin=');
-        return substr($result, $start, $end-$start);
+        return substr($result, $start, $end - $start);
     }
 
     /**
diff --git a/module/VuFind/src/VuFind/ILS/Driver/Voyager.php b/module/VuFind/src/VuFind/ILS/Driver/Voyager.php
index 2469be81108..6e8360eea19 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/Voyager.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/Voyager.php
@@ -1378,7 +1378,7 @@ class Voyager extends AbstractBase
             if (is_numeric($dueTimeStamp)) {
                 if ($now > $dueTimeStamp) {
                     $dueStatus = "overdue";
-                } else if ($now > $dueTimeStamp-(1*24*60*60)) {
+                } else if ($now > $dueTimeStamp - (1 * 24 * 60 * 60)) {
                     $dueStatus = "due";
                 }
             }
@@ -2040,8 +2040,8 @@ class Voyager extends AbstractBase
 
         $page = ($page) ? $page : 1;
         $limit = ($limit) ? $limit : 20;
-        $bindParams[':startRow'] = (($page-1)*$limit)+1;
-        $bindParams[':endRow'] = ($page*$limit);
+        $bindParams[':startRow'] = (($page - 1) * $limit) + 1;
+        $bindParams[':endRow'] = ($page * $limit);
         /*
         $sql = "select * from " .
                "(select a.*, rownum rnum from " .
diff --git a/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php b/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php
index 6ab787492ef..9c2f0a17500 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php
@@ -1976,7 +1976,7 @@ EOT;
                 $cancel = $cancel->children();
                 $node = "reply-text";
                 $reply = (string)$cancel->$node;
-                $count = ($reply == "ok") ? $count+1 : $count;
+                $count = ($reply == "ok") ? $count + 1 : $count;
 
                 $response[$itemId] = [
                     'success' => ($reply == "ok") ? true : false,
@@ -2100,7 +2100,7 @@ EOT;
                     if ($dueTimeStamp !== false && is_numeric($dueTimeStamp)) {
                         if ($now > $dueTimeStamp) {
                             $dueStatus = 'overdue';
-                        } else if ($now > $dueTimeStamp-(1*24*60*60)) {
+                        } else if ($now > $dueTimeStamp - (1 * 24 * 60 * 60)) {
                             $dueStatus = 'due';
                         }
                     }
@@ -3069,7 +3069,7 @@ EOT;
                 $cancel = $cancel->children();
                 $node = "reply-text";
                 $reply = (string)$cancel->$node;
-                $count = ($reply == "ok") ? $count+1 : $count;
+                $count = ($reply == "ok") ? $count + 1 : $count;
 
                 $response[$itemId] = [
                     'success' => ($reply == "ok") ? true : false,
diff --git a/module/VuFind/src/VuFind/OAI/Server.php b/module/VuFind/src/VuFind/OAI/Server.php
index 8a54e2a3495..dc654ca2639 100644
--- a/module/VuFind/src/VuFind/OAI/Server.php
+++ b/module/VuFind/src/VuFind/OAI/Server.php
@@ -776,13 +776,13 @@ class Server
             // Set default date range if not already provided:
             if (empty($params['from'])) {
                 $params['from'] = $this->earliestDatestamp;
-                if (strlen($params['from'])>strlen($params['until'])) {
+                if (strlen($params['from']) > strlen($params['until'])) {
                     $params['from'] = substr($params['from'], 0, 10);
                 }
             }
             if (empty($params['until'])) {
                 $params['until'] = date($this->iso8601);
-                if (strlen($params['until'])>strlen($params['from'])) {
+                if (strlen($params['until']) > strlen($params['from'])) {
                     $params['until'] = substr($params['until'], 0, 10);
                 }
             }
diff --git a/module/VuFind/src/VuFind/Recommend/AuthorInfo.php b/module/VuFind/src/VuFind/Recommend/AuthorInfo.php
index b181ec33556..ee6050b068d 100644
--- a/module/VuFind/src/VuFind/Recommend/AuthorInfo.php
+++ b/module/VuFind/src/VuFind/Recommend/AuthorInfo.php
@@ -211,10 +211,10 @@ class AuthorInfo implements RecommendInterface, TranslatorAwareInterface
         $last = $nameParts[0];
         // - move all names up an index, move last name to last
         // - Last, First M. -> First M. Last
-        for ($i = 1;$i<count($nameParts);$i++) {
-            $nameParts[$i-1] = $nameParts[$i];
+        for ($i = 1;$i < count($nameParts);$i++) {
+            $nameParts[$i - 1] = $nameParts[$i];
         }
-        $nameParts[count($nameParts)-1] = $last;
+        $nameParts[count($nameParts) - 1] = $last;
         $author = implode($nameParts, ' ');
         return $author;
     }
diff --git a/module/VuFind/src/VuFind/Recommend/AuthorityRecommend.php b/module/VuFind/src/VuFind/Recommend/AuthorityRecommend.php
index 7d068c068f4..a6a1cc9a0af 100644
--- a/module/VuFind/src/VuFind/Recommend/AuthorityRecommend.php
+++ b/module/VuFind/src/VuFind/Recommend/AuthorityRecommend.php
@@ -113,7 +113,7 @@ class AuthorityRecommend implements RecommendInterface
     {
         $params = explode(':', $settings);
         for ($i = 0; $i < count($params); $i += 2) {
-            if (isset($params[$i+1])) {
+            if (isset($params[$i + 1])) {
                 if ($params[$i] == '__resultlimit__') {
                     $this->resultLimit = intval($params[$i + 1]);
                 } else {
diff --git a/module/VuFind/src/VuFind/Recommend/RandomRecommend.php b/module/VuFind/src/VuFind/Recommend/RandomRecommend.php
index 6ce5d177128..9cfa5857544 100644
--- a/module/VuFind/src/VuFind/Recommend/RandomRecommend.php
+++ b/module/VuFind/src/VuFind/Recommend/RandomRecommend.php
@@ -151,7 +151,7 @@ class RandomRecommend implements RecommendInterface
 
         // all other params are filters and their values respectively
         for ($i = 5; $i < count($settings); $i += 2) {
-            if (isset($settings[$i+1])) {
+            if (isset($settings[$i + 1])) {
                 $this->filters[] = $settings[$i] . ':' . $settings[$i + 1];
             }
         }
diff --git a/module/VuFind/src/VuFind/Resolver/Driver/Redi.php b/module/VuFind/src/VuFind/Resolver/Driver/Redi.php
index 93f624c6344..2f1dbda52b2 100644
--- a/module/VuFind/src/VuFind/Resolver/Driver/Redi.php
+++ b/module/VuFind/src/VuFind/Resolver/Driver/Redi.php
@@ -139,7 +139,7 @@ class Redi implements DriverInterface
             ->query("//dd[@class='doi_d']");
 
         if ($doiTerm->length == $doiDefinition->length) {
-            for ($i = 0; $i<$doiTerm->length; $i++) {
+            for ($i = 0; $i < $doiTerm->length; $i++) {
                 $href = $xpath
                     ->query(".//@href", $doiDefinition->item($i))
                     ->item(0)->textContent;
@@ -172,7 +172,7 @@ class Redi implements DriverInterface
         $infoTokenNodes = $xpath->query("//div[@id='t_ezb']/div[@class='t']/p/sup");
 
         if ($infoTokenNodes->length > 0) {
-            for ($i = 0; $i<$infoTokenNodes->length; $i++) {
+            for ($i = 0; $i < $infoTokenNodes->length; $i++) {
                 if ($infoToken == $infoTokenNodes->item($i)->textContent) {
                     return $xpath
                         ->query("//div[@id='t_ezb']/div[@class='t']/p/sup/..")
@@ -204,16 +204,16 @@ class Redi implements DriverInterface
             ->query("//div[@class='t_ezb_result']/p/span[@class='t_link']/a");
 
         if ($ezbResultsNodesText->length == $ezbResultsNodesURL->length) {
-            for ($i = 0; $i<$ezbResultsNodesText->length; $i++) {
+            for ($i = 0; $i < $ezbResultsNodesText->length; $i++) {
 
                 $accessClass = 'unknown';
                 $accessClassExpressions = [
                     "denied"    => "//div[@class='t_ezb_result']["
-                        . ($i+1) . "]/p/span[@class='t_ezb_red']",
+                        . ($i + 1) . "]/p/span[@class='t_ezb_red']",
                     "limited" => "//div[@class='t_ezb_result']["
-                        . ($i+1) . "]/p/span[@class='t_ezb_yellow']",
+                        . ($i + 1) . "]/p/span[@class='t_ezb_yellow']",
                     "open"  => "//div[@class='t_ezb_result']["
-                        . ($i+1) . "]/p/span[@class='t_ezb_green']",
+                        . ($i + 1) . "]/p/span[@class='t_ezb_green']",
                 ]; // $i+1 because XPath-element-counting starts with 1
                 foreach ($accessClassExpressions as $key => $value) {
                     if ($xpath->evaluate("count({$value})") == 1) {
@@ -224,7 +224,7 @@ class Redi implements DriverInterface
                 $itemInfo = '';
 
                 $expression = "//div[@class='t_ezb_result']["
-                    . ($i+1) . "]/p/sup";
+                    . ($i + 1) . "]/p/sup";
                 if ($xpath->evaluate("count({$expression})") == 1) {
                     $itemInfo = $this->parseRediInfo(
                         $xml, $xpath->query($expression)->item(0)->textContent
diff --git a/module/VuFind/src/VuFind/Search/EIT/Options.php b/module/VuFind/src/VuFind/Search/EIT/Options.php
index b30cd959c47..96d748fc1c8 100644
--- a/module/VuFind/src/VuFind/Search/EIT/Options.php
+++ b/module/VuFind/src/VuFind/Search/EIT/Options.php
@@ -41,7 +41,6 @@ namespace VuFind\Search\EIT;
  */
 class Options extends \VuFind\Search\Base\Options
 {
-    
     /**
      * Constructor
      *
diff --git a/module/VuFind/src/VuFind/Search/Solr/AbstractErrorListener.php b/module/VuFind/src/VuFind/Search/Solr/AbstractErrorListener.php
index b3a88aa39a2..c61138ce967 100644
--- a/module/VuFind/src/VuFind/Search/Solr/AbstractErrorListener.php
+++ b/module/VuFind/src/VuFind/Search/Solr/AbstractErrorListener.php
@@ -46,7 +46,6 @@ use SplObjectStorage;
  */
 abstract class AbstractErrorListener
 {
-
     /**
      * Tag indicating a parser error.
      *
diff --git a/module/VuFind/src/VuFind/Search/Solr/V4/ErrorListener.php b/module/VuFind/src/VuFind/Search/Solr/V4/ErrorListener.php
index 9e15ae91790..b806b95d252 100644
--- a/module/VuFind/src/VuFind/Search/Solr/V4/ErrorListener.php
+++ b/module/VuFind/src/VuFind/Search/Solr/V4/ErrorListener.php
@@ -45,7 +45,6 @@ use Zend\EventManager\EventInterface;
  */
 class ErrorListener extends AbstractErrorListener
 {
-
     /**
      * Normalized media types.
      *
diff --git a/module/VuFind/src/VuFind/SimpleXML.php b/module/VuFind/src/VuFind/SimpleXML.php
index d166f01b52f..8c416cdbdd9 100644
--- a/module/VuFind/src/VuFind/SimpleXML.php
+++ b/module/VuFind/src/VuFind/SimpleXML.php
@@ -55,7 +55,7 @@ class SimpleXML
 
         // strip off xml header
         $mark = strpos($xml, '?' . '>');
-        if ($mark>0 && $mark<40) {
+        if ($mark > 0 && $mark < 40) {
             $xml = substr($xml, $mark + 2);
         }
 
diff --git a/module/VuFind/src/VuFind/Statistics/AbstractBase.php b/module/VuFind/src/VuFind/Statistics/AbstractBase.php
index 87cab2bb66c..9edd590438f 100644
--- a/module/VuFind/src/VuFind/Statistics/AbstractBase.php
+++ b/module/VuFind/src/VuFind/Statistics/AbstractBase.php
@@ -235,7 +235,7 @@ abstract class AbstractBase
         }
         if (strpos($agent, "Chrome") > -1) {
             $split = explode(' ', $agent);
-            return str_replace('/', ' ', $split[count($split)-2]);
+            return str_replace('/', ' ', $split[count($split) - 2]);
         }
         if (strpos($agent, "Firefox") > -1 || strpos($agent, "Safari") > -1) {
             $split = explode(' ', $agent);
diff --git a/module/VuFind/src/VuFind/Statistics/Driver/Solr.php b/module/VuFind/src/VuFind/Statistics/Driver/Solr.php
index 038a30733db..55ef0551ab8 100644
--- a/module/VuFind/src/VuFind/Statistics/Driver/Solr.php
+++ b/module/VuFind/src/VuFind/Statistics/Driver/Solr.php
@@ -166,7 +166,7 @@ class Solr extends AbstractBase
                 'count' => $count
             ];
             // Insert sort (limit to listLength)
-            for ($i = 0;$i<$listLength-1 && $i<count($solrBrowsers);$i++) {
+            for ($i = 0;$i < $listLength - 1 && $i < count($solrBrowsers);$i++) {
                 if ($count > $solrBrowsers[$i]['count']) {
                     // Insert in order
                     array_splice($solrBrowsers, $i, 0, [$newBrowser]);
diff --git a/module/VuFind/src/VuFind/Statistics/Record.php b/module/VuFind/src/VuFind/Statistics/Record.php
index 8a06200aba8..b1d46cd841e 100644
--- a/module/VuFind/src/VuFind/Statistics/Record.php
+++ b/module/VuFind/src/VuFind/Statistics/Record.php
@@ -74,7 +74,7 @@ class Record extends AbstractBase
                 $sources = $driver->getFullList('recordSource');
                 $hashes = [];
                 // Generate hashes (faster than grouping by looping)
-                for ($i = 0;$i<count($summary);$i++) {
+                for ($i = 0;$i < count($summary);$i++) {
                     $source = $sources[$i]['recordSource'];
                     $id = $summary[$i]['recordId'];
                     $hashes[$source][$id]
@@ -99,7 +99,7 @@ class Record extends AbstractBase
                             'source' => $source
                         ];
                         // Insert sort (limit to listLength)
-                        for ($i = 0;$i<$listLength-1 && $i<count($reference);$i++) {
+                        for ($i = 0;$i < $listLength - 1 && $i < count($reference);$i++) {
                             if ($count > $reference[$i]['count']) {
                                 // Insert in order
                                 array_splice($reference, $i, 0, [$newRecord]);
diff --git a/module/VuFind/src/VuFind/Statistics/Search.php b/module/VuFind/src/VuFind/Statistics/Search.php
index 5d9acacb3ba..6daefcf6e07 100644
--- a/module/VuFind/src/VuFind/Statistics/Search.php
+++ b/module/VuFind/src/VuFind/Statistics/Search.php
@@ -75,7 +75,7 @@ class Search extends AbstractBase
                 $sources = $driver->getFullList('searchSource');
                 $hashes = [];
                 // Generate hashes (faster than grouping by looping)
-                for ($i = 0;$i<count($summary);$i++) {
+                for ($i = 0;$i < count($summary);$i++) {
                     if (!isset($sources[$i]['searchSource'])) {
                         $sources[$i]['searchSource'] = 'Search';
                     } else {
@@ -113,7 +113,7 @@ class Search extends AbstractBase
                             'source' => $source
                         ];
                         // Insert sort (limit to listLength)
-                        for ($i = 0;$i<$listLength-1 && $i<count($reference);$i++) {
+                        for ($i = 0;$i < $listLength - 1 && $i < count($reference);$i++) {
                             if ($count > $reference[$i]['count']) {
                                 // Insert in order
                                 array_splice($reference, $i, 0, [$newRecord]);
diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Citation.php b/module/VuFind/src/VuFind/View/Helper/Root/Citation.php
index 669b4c1906d..81279250a13 100644
--- a/module/VuFind/src/VuFind/View/Helper/Root/Citation.php
+++ b/module/VuFind/src/VuFind/View/Helper/Root/Citation.php
@@ -704,7 +704,7 @@ class Citation extends \Zend\View\Helper\AbstractHelper
                 $authorStr = $this->cleanNameDates($author) . ', et al';
             } else {
                 foreach ($this->details['authors'] as $author) {
-                    if (($i+1 == count($this->details['authors'])) && ($i > 0)) {
+                    if (($i + 1 == count($this->details['authors'])) && ($i > 0)) {
                         // Last
                         $authorStr .= ', and ' .
                             $this->reverseName($this->stripPunctuation($author));
diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Printms.php b/module/VuFind/src/VuFind/View/Helper/Root/Printms.php
index 073d5e3b141..bcf97128a71 100644
--- a/module/VuFind/src/VuFind/View/Helper/Root/Printms.php
+++ b/module/VuFind/src/VuFind/View/Helper/Root/Printms.php
@@ -48,21 +48,21 @@ class Printms extends AbstractHelper
      */
     public function __invoke($ms)
     {
-        $seconds = floor($ms/1000);
+        $seconds = floor($ms / 1000);
         $ms = ($ms % 1000);
 
-        $minutes = floor($seconds/60);
+        $minutes = floor($seconds / 60);
         $seconds = ($seconds % 60);
 
-        $hours = floor($minutes/60);
+        $hours = floor($minutes / 60);
         $minutes = ($minutes % 60);
 
         if ($hours) {
-            $days = floor($hours/60);
+            $days = floor($hours / 60);
             $hours = ($hours % 60);
 
             if ($days) {
-                $years = floor($days/365);
+                $years = floor($days / 365);
                 $days = ($days % 365);
 
                 if ($years) {
diff --git a/module/VuFind/src/VuFind/View/Helper/Root/ResultFeed.php b/module/VuFind/src/VuFind/View/Helper/Root/ResultFeed.php
index b2978567786..be0c2d20e71 100644
--- a/module/VuFind/src/VuFind/View/Helper/Root/ResultFeed.php
+++ b/module/VuFind/src/VuFind/View/Helper/Root/ResultFeed.php
@@ -144,7 +144,7 @@ class ResultFeed extends AbstractHelper implements TranslatorAwareInterface
         if ($params->getPage() > 1) {
             $feed->addOpensearchLink(
                 $baseUrl . $results->getUrlQuery()
-                    ->setPage($params->getPage()-1, false),
+                    ->setPage($params->getPage() - 1, false),
                 'previous',
                 $params->getView()
             );
@@ -153,7 +153,7 @@ class ResultFeed extends AbstractHelper implements TranslatorAwareInterface
         if ($params->getPage() < $lastPage) {
             $feed->addOpensearchLink(
                 $baseUrl . $results->getUrlQuery()
-                    ->setPage($params->getPage()+1, false),
+                    ->setPage($params->getPage() + 1, false),
                 'next',
                 $params->getView()
             );
diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Config/Reader/CacheDecoratorTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Config/Reader/CacheDecoratorTest.php
index 54a188b7dcd..5125b0e1d70 100644
--- a/module/VuFind/tests/unit-tests/src/VuFindTest/Config/Reader/CacheDecoratorTest.php
+++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Config/Reader/CacheDecoratorTest.php
@@ -41,7 +41,6 @@ use VuFind\Config\Reader\CacheDecorator;
  */
 class CacheDecoratorTest extends \PHPUnit_Framework_TestCase
 {
-
     /**
      * Read config from while, new file.
      *
diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/DAIATest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/DAIATest.php
index 16519f97745..509df5fc106 100644
--- a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/DAIATest.php
+++ b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/DAIATest.php
@@ -45,7 +45,6 @@ use InvalidArgumentException;
  */
 class DAIATest extends \VuFindTest\Unit\ILSDriverTestCase
 {
-
     /**
      * Constructor
      */
diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/MultiBackendTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/MultiBackendTest.php
index 91d089b4079..08700dbd610 100644
--- a/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/MultiBackendTest.php
+++ b/module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/MultiBackendTest.php
@@ -30,7 +30,6 @@
 namespace VuFindTest\ILS\Driver;
 use VuFind\ILS\Driver\MultiBackend, VuFind\Config\Reader as ConfigReader;
 use Zend\Log\Writer\Mock;
-use Zend\Log\Logger;
 
 /**
  * ILS driver test
diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/RediTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/RediTest.php
index 53e9c42835f..2bf5d0cca35 100644
--- a/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/RediTest.php
+++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Resolver/Driver/RediTest.php
@@ -46,7 +46,6 @@ use InvalidArgumentException;
  */
 class RediTest extends \VuFindTest\Unit\TestCase
 {
-
     /**
      * Test-Config
      *
diff --git a/module/VuFindSearch/Module.php b/module/VuFindSearch/Module.php
index 1f157531372..c37a4040e17 100644
--- a/module/VuFindSearch/Module.php
+++ b/module/VuFindSearch/Module.php
@@ -56,7 +56,6 @@ namespace VuFindSearch;
  */
 class Module
 {
-
     /**
      * Return autoloader configuration.
      *
diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/AbstractHandlerMap.php b/module/VuFindSearch/src/VuFindSearch/Backend/AbstractHandlerMap.php
index 5631551713c..580d75ed1c6 100644
--- a/module/VuFindSearch/src/VuFindSearch/Backend/AbstractHandlerMap.php
+++ b/module/VuFindSearch/src/VuFindSearch/Backend/AbstractHandlerMap.php
@@ -46,7 +46,6 @@ use VuFindSearch\ParamBag;
  */
 abstract class AbstractHandlerMap
 {
-
     /**
      * Prepare final set of parameters for search function.
      *
diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Backend.php b/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Backend.php
index 4b25c8a40b3..845a9e43133 100644
--- a/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Backend.php
+++ b/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Backend.php
@@ -419,7 +419,7 @@ class Backend extends AbstractBackend
             // Check to see if the token expiration time is greater than the current
             // time.  If the token is expired or within 5 minutes of expiring,
             // generate a new one.
-            if (!empty($currentToken) && (time() <= ($expirationTime - (60*5)))) {
+            if (!empty($currentToken) && (time() <= ($expirationTime - (60 * 5)))) {
                 return $currentToken;
             }
         }
diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/EDS/SearchRequestModel.php b/module/VuFindSearch/src/VuFindSearch/Backend/EDS/SearchRequestModel.php
index c0b927247a3..32329dc1f52 100644
--- a/module/VuFindSearch/src/VuFindSearch/Backend/EDS/SearchRequestModel.php
+++ b/module/VuFindSearch/src/VuFindSearch/Backend/EDS/SearchRequestModel.php
@@ -146,7 +146,7 @@ class SearchRequestModel
     {
         // PublicationDate:[xxxx TO xxxx]
         $dates = substr($filter, 17);
-        $dates = substr($dates, 0, strlen($dates)-1);
+        $dates = substr($dates, 0, strlen($dates) - 1);
         $parts = explode(' TO ', $dates, 2);
         if (count($parts) == 2) {
             $start = trim($parts[0]);
diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Document/CommitDocument.php b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Document/CommitDocument.php
index 7ac36f8478b..9fc0d601ead 100644
--- a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Document/CommitDocument.php
+++ b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Document/CommitDocument.php
@@ -41,7 +41,6 @@ use XMLWriter;
  */
 class CommitDocument extends AbstractDocument
 {
-
     /**
      * Value for commitWithin attribute
      *
diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Document/OptimizeDocument.php b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Document/OptimizeDocument.php
index c0a4b335afa..d09ac12f753 100644
--- a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Document/OptimizeDocument.php
+++ b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Document/OptimizeDocument.php
@@ -41,7 +41,6 @@ use XMLWriter;
  */
 class OptimizeDocument extends AbstractDocument
 {
-
     /**
      * Value for waitFlush attribute
      *
diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Document/UpdateDocument.php b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Document/UpdateDocument.php
index aaec97e53ab..48cf993694f 100644
--- a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Document/UpdateDocument.php
+++ b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Document/UpdateDocument.php
@@ -43,7 +43,6 @@ use XMLWriter;
  */
 class UpdateDocument extends AbstractDocument
 {
-
     /**
      * Records and index attributes.
      *
diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Response/Json/Record.php b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Response/Json/Record.php
index c34af0aca61..093dee490ee 100644
--- a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Response/Json/Record.php
+++ b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Response/Json/Record.php
@@ -44,7 +44,6 @@ use VuFindSearch\Response\RecordInterface;
  */
 class Record implements RecordInterface
 {
-
     /**
      * SOLR fields.
      *
diff --git a/module/VuFindSearch/src/VuFindSearch/Response/RecordCollectionInterface.php b/module/VuFindSearch/src/VuFindSearch/Response/RecordCollectionInterface.php
index ccbd3b13a1f..747929e5319 100644
--- a/module/VuFindSearch/src/VuFindSearch/Response/RecordCollectionInterface.php
+++ b/module/VuFindSearch/src/VuFindSearch/Response/RecordCollectionInterface.php
@@ -39,7 +39,6 @@ namespace VuFindSearch\Response;
  */
 interface RecordCollectionInterface extends \Countable, \Iterator
 {
-
     /**
      * Return total number of records found.
      *
diff --git a/module/VuFindSearch/src/VuFindSearch/Response/RecordInterface.php b/module/VuFindSearch/src/VuFindSearch/Response/RecordInterface.php
index 333c6e12854..b5a87767dee 100644
--- a/module/VuFindSearch/src/VuFindSearch/Response/RecordInterface.php
+++ b/module/VuFindSearch/src/VuFindSearch/Response/RecordInterface.php
@@ -41,7 +41,6 @@ namespace VuFindSearch\Response;
  */
 interface RecordInterface
 {
-
     /**
      * Set the source backend identifier.
      *
diff --git a/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/AbstractHandlerMapTest.php b/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/AbstractHandlerMapTest.php
index fb6c5001953..5c336b5fdac 100644
--- a/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/AbstractHandlerMapTest.php
+++ b/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/AbstractHandlerMapTest.php
@@ -28,7 +28,6 @@
  */
 namespace VuFindTest\Backend;
 
-use VuFindSearch\Backend\AbstractHandlerMap;
 use VuFindSearch\ParamBag;
 
 use PHPUnit_Framework_TestCase as TestCase;
diff --git a/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/EDS/BackendTest.php b/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/EDS/BackendTest.php
index 1004c3c5a96..ac5572d622b 100644
--- a/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/EDS/BackendTest.php
+++ b/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/EDS/BackendTest.php
@@ -29,7 +29,6 @@
 namespace VuFindTest\Backend\EDS;
 
 use VuFindSearch\Backend\EDS\Backend;
-use VuFindSearch\Backend\EDS\Response\RecordCollectionFactory;
 use VuFindSearch\Query\Query;
 use InvalidArgumentException;
 
diff --git a/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/EIT/BackendTest.php b/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/EIT/BackendTest.php
index ec2854dcc04..b8a548411e3 100644
--- a/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/EIT/BackendTest.php
+++ b/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/EIT/BackendTest.php
@@ -30,7 +30,6 @@ namespace VuFindTest\Backend\EIT;
 
 use VuFindSearch\Backend\EIT\Backend;
 use VuFindSearch\Backend\EIT\QueryBuilder;
-use VuFindSearch\Backend\EIT\Response\RecordCollectionFactory;
 use VuFindSearch\Query\Query;
 use InvalidArgumentException;
 
diff --git a/module/VuFindSearch/tests/unit-tests/src/VuFindTest/SearchServiceTest.php b/module/VuFindSearch/tests/unit-tests/src/VuFindTest/SearchServiceTest.php
index f65158c1118..14c147f3a49 100644
--- a/module/VuFindSearch/tests/unit-tests/src/VuFindTest/SearchServiceTest.php
+++ b/module/VuFindSearch/tests/unit-tests/src/VuFindTest/SearchServiceTest.php
@@ -345,7 +345,7 @@ class SearchServiceTest extends TestCase
         $responseForZero->expects($this->once())->method('getTotal')
             ->will($this->returnValue($total));
 
-        for ($i = 1; $i<$limit+1; $i++) {
+        for ($i = 1; $i < $limit + 1; $i++) {
             $response = $this->getRecordCollection();
             $response->expects($this->any())->method('first')
                 ->will($this->returnValue($this->getMock('VuFindSearch\Response\RecordInterface')));
@@ -727,5 +727,4 @@ abstract class TestBackendClassForSimilar
 abstract class TestClassForRandomInterface
 implements BackendInterface, RandomInterface
 {
-
 }
\ No newline at end of file
diff --git a/module/VuFindTheme/src/VuFindTheme/LessCompiler.php b/module/VuFindTheme/src/VuFindTheme/LessCompiler.php
index a128979ac8a..755907f7eea 100644
--- a/module/VuFindTheme/src/VuFindTheme/LessCompiler.php
+++ b/module/VuFindTheme/src/VuFindTheme/LessCompiler.php
@@ -217,7 +217,7 @@ class LessCompiler
         }
         file_put_contents($finalFile, $this->makeRelative($css, $less));
 
-        $this->logMessage("\t\t" . (microtime(true)-$start) . ' sec');
+        $this->logMessage("\t\t" . (microtime(true) - $start) . ' sec');
     }
 
     /**
-- 
GitLab