From 6809a3f8a4aa0cdc6a79359f45830da00143cc7c Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Sat, 14 Oct 2017 11:56:50 +0000 Subject: [PATCH 1/2] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- bnb/recherche.php | 2 +- isbn/b3kat.php | 22 +++++++++++----------- isbn/hebis.php | 14 +++++++------- isbn/lib.php | 6 +++--- isbn/man-sru.php | 20 ++++++++++---------- isbn/nebis.php | 10 +++++----- 6 files changed, 37 insertions(+), 37 deletions(-) diff --git a/bnb/recherche.php b/bnb/recherche.php index e7b9dfc..13a4711 100644 --- a/bnb/recherche.php +++ b/bnb/recherche.php @@ -214,7 +214,7 @@ $mapDate = array(3242 => "08/05/2013", 3241 => "01/05/2013", 3240 => "24/04/2013", 3239 => "17/04/2013", 3238 => "10/04/2013", 3237 => "03/04/2013", 3236 => "20/03/2013", 3231 => "13/02/2013"); $files = glob('BNBDaten/*.rdf'); - usort($files, function ($a, $b) { + usort($files, function($a, $b) { return $a < $b; }); echo ""; diff --git a/isbn/b3kat.php b/isbn/b3kat.php index 0f6a78f..c5819a8 100644 --- a/isbn/b3kat.php +++ b/isbn/b3kat.php @@ -28,7 +28,7 @@ include 'lib.php'; -$id = yaz_connect(B3KAT_URL, array("user" => B3KAT_USER, "password" => B3KAT_PASSWORD));//"mab2; charset=iso5426,utf8" +$id = yaz_connect(B3KAT_URL, array("user" => B3KAT_USER, "password" => B3KAT_PASSWORD)); //"mab2; charset=iso5426,utf8" yaz_syntax($id, B3KAT_SYNTAX); yaz_range($id, 1, 10); yaz_element($id, B3KAT_ELEMENTSET); @@ -41,10 +41,10 @@ if (isset($_GET['isbn'])) { $n = trim($_GET['isbn']); $nArray = explode(",", $n); - if (count($nArray)>1) { + if (count($nArray) > 1) { //mehrere ISBNs, z.B. f @or @or @attr 1=7 "9783937219363" @attr 1=7 "9780521369107" @attr 1=7 "9780521518147" //Anfuehrungsstriche muessen demaskiert werden, egal ob String mit ' gemacht wird - $suchString = str_repeat("@or ", count($nArray)-1) . '@attr 1=7 \"' . implode('\" @attr 1=7 \"', $nArray) . '\"'; + $suchString = str_repeat("@or ", count($nArray) - 1) . '@attr 1=7 \"' . implode('\" @attr 1=7 \"', $nArray) . '\"'; yaz_search($id, "rpn", $suchString); } else { yaz_search($id, "rpn", '@attr 5=100 @attr 1=7 "' . $n . '"'); @@ -57,7 +57,7 @@ $error = yaz_error($id); if (!empty($error)) { echo "Error Number: " . yaz_errno($id); - echo "Error Description: " . $error ; + echo "Error Description: " . $error; echo "Additional Error Information: " . yaz_addinfo($id); } @@ -67,23 +67,23 @@ for ($p = 1; $p <= yaz_hits($id); $p++) { - $record = yaz_record($id, $p, "render;charset=iso5426,utf8");//render;charset=iso5426,utf8 - $recordArray = explode("\x1e", $record); + $record = yaz_record($id, $p, "render;charset=iso5426,utf8"); //render;charset=iso5426,utf8 + $recordArray = explode("\x1e", $record); $header = substr($recordArray[0], 0, 24); - $recordContent = ''."\n"; + $recordContent = '' . "\n"; $recordContent .= printLine(substr($recordArray[0], 24)); for ($j = 1; $j < count($recordArray); $j++) { $recordContent .= printLine($recordArray[$j]); } - $recordContent .= ''."\n"; - $outputString .= $recordContent; + $recordContent .= '' . "\n"; + $outputString .= $recordContent; array_push($outputArray, $recordContent); } -$outputString .= ""; +$outputString .= ""; yaz_close($id); $map = $standardMabMap; @@ -93,7 +93,7 @@ header('Content-type: text/xml'); echo $outputString; -} else if ($_GET['format']=='json') { +} else if ($_GET['format'] == 'json') { $outputXml = simplexml_load_string($outputString); $outputMap = performMapping($map, $outputXml); diff --git a/isbn/hebis.php b/isbn/hebis.php index a4187fd..9a7df16 100644 --- a/isbn/hebis.php +++ b/isbn/hebis.php @@ -29,7 +29,7 @@ include 'lib.php'; $id = yaz_connect(HEBIS_URL); -yaz_syntax($id, HEBIS_SYNTAX);// +yaz_syntax($id, HEBIS_SYNTAX); // yaz_range($id, 1, 10); yaz_element($id, HEBIS_ELEMENTSET); // @@ -43,7 +43,7 @@ if (count($nArray) > 1) { //mehrere ISBNs, z.B. f @or @or @attr 1=7 "9783937219363" @attr 1=7 "9780521369107" @attr 1=7 "9780521518147" //Anfuehrungsstriche muessen demaskiert werden, egal ob String mit ' gemacht wird - $suchString = str_repeat("@or ", count($nArray)-1) . '@attr 1=7 \"' . implode('\" @attr 1=7 \"', $nArray) . '\"'; + $suchString = str_repeat("@or ", count($nArray) - 1) . '@attr 1=7 \"' . implode('\" @attr 1=7 \"', $nArray) . '\"'; yaz_search($id, "rpn", $suchString); } else { yaz_search($id, "rpn", '@attr 5=100 @attr 1=7 "' . $n . '"'); @@ -55,7 +55,7 @@ $error = yaz_error($id); if (!empty($error)) { echo "Error Number: " . yaz_errno($id); - echo "Error Description: " . $error ; + echo "Error Description: " . $error; echo "Additional Error Information: " . yaz_addinfo($id); } @@ -64,13 +64,13 @@ $outputArray = []; for ($p = 1; $p <= yaz_hits($id); $p++) { - $record = yaz_record($id, $p, "xml");//Umwandlung in XML + $record = yaz_record($id, $p, "xml"); //Umwandlung in XML //namespace löschen $record = str_replace('xmlns="http://www.loc.gov/MARC21/slim"', '', $record); - $outputString .= $record; + $outputString .= $record; array_push($outputArray, $record); } -$outputString .= ""; +$outputString .= ""; yaz_close($id); $map = $standardMarcMap; @@ -80,7 +80,7 @@ if (!isset($_GET['format'])) { header('Content-type: text/xml'); echo $outputString; -} else if ($_GET['format']=='json') { +} else if ($_GET['format'] == 'json') { $outputXml = simplexml_load_string($outputString); $outputMap = performMapping($map, $outputXml); $outputIndividualMap = []; diff --git a/isbn/lib.php b/isbn/lib.php index 943d267..7443d2c 100644 --- a/isbn/lib.php +++ b/isbn/lib.php @@ -229,14 +229,14 @@ function printLine($line) $ind = substr($line, 3, 1); $inhalt = substr($line, 4); if (strstr($inhalt, "\x1f")) { - $lineArray = explode("\x1f", $inhalt); + $lineArray = explode("\x1f", $inhalt); $output .= "\n"; for ($k = 1; $k < count($lineArray); $k++) { - $output .= ''.printMabContent(substr($lineArray[$k], 1)).''."\n"; + $output .= '' . printMabContent(substr($lineArray[$k], 1)) . '' . "\n"; } $output .= ""; } else { - $output .= ''.printMabContent($inhalt).''."\n"; + $output .= '' . printMabContent($inhalt) . '' . "\n"; } } return $output; diff --git a/isbn/man-sru.php b/isbn/man-sru.php index edcc5fb..d1a59d5 100644 --- a/isbn/man-sru.php +++ b/isbn/man-sru.php @@ -62,7 +62,7 @@ @$doc->loadHTML($result); $xpath = new DOMXPath($doc); -$records = $xpath->query("//records/record/recorddata/record");//beachte: kein CamelCase sondern alles klein schreiben +$records = $xpath->query("//records/record/recorddata/record"); //beachte: kein CamelCase sondern alles klein schreiben $outputString = "\n"; $outputString .= "\n"; @@ -70,10 +70,10 @@ foreach ($records as $record) { - $outputString .= $doc->saveXML($record); + $outputString .= $doc->saveXML($record); array_push($outputArray, $doc->saveXML($record)); } -$outputString .= ""; +$outputString .= ""; $map = $standardMarcMap; @@ -82,7 +82,7 @@ if (!isset($_GET['format'])) { header('Content-type: text/xml'); echo $outputString; -} else if ($_GET['format']=='json') { +} else if ($_GET['format'] == 'json') { $outputXml = simplexml_load_string($outputString); $outputMap = performMapping($map, $outputXml); @@ -97,7 +97,7 @@ header('Content-type: application/json'); echo json_encode($outputMap, JSON_PRETTY_PRINT); -} else if ($_GET['format']=='holdings') { +} else if ($_GET['format'] == 'holdings') { echo "\n\n Bestand UB Mannheim zu ISBN-Suche\n \n \n\n\n"; $outputXml = simplexml_load_string($outputString); $avaNodes = $outputXml->xpath('//datafield[@tag="AVA"]'); @@ -149,7 +149,7 @@ echo '
Bestand der UB Mannheim: '; foreach ($bestand as $loc => $n) { - echo $n . "x" . $loc . ", "; + echo $n . "x" . $loc . ", "; } if ($aveNodes) { echo "E"; @@ -177,17 +177,17 @@ echo '
Bestand der UB Mannheim: eventuell da (' . $size . ")
\n"; echo '
See SRU Result
'; } else { - $urlSWB='http://swb.bsz-bw.de/DB=2.1/SET=11/TTL=2/CMD?ACT=SRCHM&ACT0=SRCH&IKT0=2135&TRM0=%60180%60&ACT1=*&IKT1=1016&TRM1=' . str_replace(" ", "+", $suchStringSWB); + $urlSWB = 'http://swb.bsz-bw.de/DB=2.1/SET=11/TTL=2/CMD?ACT=SRCHM&ACT0=SRCH&IKT0=2135&TRM0=%60180%60&ACT1=*&IKT1=1016&TRM1=' . str_replace(" ", "+", $suchStringSWB); $contentSWB = utf8_decode(file_get_contents($urlSWB)); //echo $contentSWB; - if (strpos($contentSWB, "Es wurde nichts gefunden")===false) { + if (strpos($contentSWB, "Es wurde nichts gefunden") === false) { $nhits = substr_count($contentSWB, 'class="hit"'); if ($nhits !== 0) {//multiple results - $nhits = $nhits/2; + $nhits = $nhits / 2; } else {//single result $nhits = substr_count($contentSWB, 'class="Z3988"'); } - echo '
Bestand der UB Mannheim: SWB sagt ja (' . $nhits .' Treffer)
'; + echo '
Bestand der UB Mannheim: SWB sagt ja (' . $nhits . ' Treffer)
'; } else { echo 'Es wurde nichts gefunden'; diff --git a/isbn/nebis.php b/isbn/nebis.php index 0e2d95d..259a547 100644 --- a/isbn/nebis.php +++ b/isbn/nebis.php @@ -43,7 +43,7 @@ if (count($nArray) > 1) { //mehrere ISBNs, z.B. f @or @or @attr 1=7 "9783937219363" @attr 1=7 "9780521369107" @attr 1=7 "9780521518147" //Anfuehrungsstriche muessen demaskiert werden, egal ob String mit ' gemacht wird - $suchString = str_repeat("@or ", count($nArray)-1) . '@attr 1=7 \"' . implode('\" @attr 1=7 \"', $nArray) . '\"'; + $suchString = str_repeat("@or ", count($nArray) - 1) . '@attr 1=7 \"' . implode('\" @attr 1=7 \"', $nArray) . '\"'; yaz_search($id, "rpn", $suchString); } else { yaz_search($id, "rpn", '@attr 5=100 @attr 1=7 "' . $n . '"'); @@ -56,7 +56,7 @@ $error = yaz_error($id); if (!empty($error)) { echo "Error Number: " . yaz_errno($id); - echo "Error Description: " . $error ; + echo "Error Description: " . $error; echo "Additional Error Information: " . yaz_addinfo($id); } @@ -68,10 +68,10 @@ $record = yaz_record($id, $p, "xml"); //namespace löschen $record = str_replace('xmlns="http://www.loc.gov/MARC21/slim"', '', $record); - $outputString .= $record; + $outputString .= $record; array_push($outputArray, $record); } -$outputString .= ""; +$outputString .= ""; yaz_close($id); @@ -83,7 +83,7 @@ header('Content-type: text/xml'); echo $outputString; -} else if ($_GET['format']=='json') { +} else if ($_GET['format'] == 'json') { $outputXml = simplexml_load_string($outputString); $outputMap = performMapping($map, $outputXml); From 61e6a490227ec7638440588c8aa7783b6e1d380f Mon Sep 17 00:00:00 2001 From: Philipp Zumstein Date: Sat, 14 Oct 2017 16:29:39 +0200 Subject: [PATCH 2/2] Add space before parentheses in anonymous function again --- bnb/recherche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bnb/recherche.php b/bnb/recherche.php index 13a4711..e7b9dfc 100644 --- a/bnb/recherche.php +++ b/bnb/recherche.php @@ -214,7 +214,7 @@ $mapDate = array(3242 => "08/05/2013", 3241 => "01/05/2013", 3240 => "24/04/2013", 3239 => "17/04/2013", 3238 => "10/04/2013", 3237 => "03/04/2013", 3236 => "20/03/2013", 3231 => "13/02/2013"); $files = glob('BNBDaten/*.rdf'); - usort($files, function($a, $b) { + usort($files, function ($a, $b) { return $a < $b; }); echo "";