From 30e3d8bf690eeb8847d8af3faa6d10b08fd45d2d Mon Sep 17 00:00:00 2001 From: Sebastian Meyer Date: Thu, 16 Jan 2020 15:36:33 +0100 Subject: [PATCH] Fix Codacy Code Style Issues --- Classes/OAI2Response.php | 8 ++++---- Classes/OAI2Server.php | 12 ++++++------ update.php | 4 +++- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Classes/OAI2Response.php b/Classes/OAI2Response.php index 475a8ee..d3d6fe7 100644 --- a/Classes/OAI2Response.php +++ b/Classes/OAI2Response.php @@ -44,7 +44,7 @@ class OAI2Response { if (!empty($this->verb)) { $request->setAttribute('verb', $this->verb); } - foreach($request_args as $key => $value) { + foreach ($request_args as $key => $value) { $request->setAttribute($key, $value); } } @@ -91,14 +91,14 @@ class OAI2Response { * Otherwise it will be attached to the desired node defined in $add_to_node. */ public function createHeader($identifier, $timestamp, $deleted = false, $add_to_node = null) { - if(is_null($add_to_node)) { + if (is_null($add_to_node)) { $header_node = $this->addToVerbNode('header'); } else { $header_node = $this->addChild($add_to_node, 'header'); } $this->addChild($header_node, 'identifier', $identifier); $this->addChild($header_node, 'datestamp', $timestamp); - if($deleted) { + if ($deleted) { $header_node->setAttribute('status', 'deleted'); } return $header_node; @@ -114,7 +114,7 @@ class OAI2Response { */ public function createResumptionToken($token, $expirationdatetime, $num_rows, $cursor = null) { $resump_node = $this->addChild($this->verbNode, 'resumptionToken', $token); - if(isset($expirationdatetime)) { + if (isset($expirationdatetime)) { $resump_node->setAttribute('expirationDate', $expirationdatetime); } $resump_node->setAttribute('completeListSize', $num_rows); diff --git a/Classes/OAI2Server.php b/Classes/OAI2Server.php index 23afe21..966d82f 100644 --- a/Classes/OAI2Server.php +++ b/Classes/OAI2Server.php @@ -63,7 +63,7 @@ class OAI2Server { } $errorResponse = new OAI2Response($this->uri, $this->verb, $this->args); $oai_node = $errorResponse->doc->documentElement; - foreach($this->errors as $e) { + foreach ($this->errors as $e) { $node = $errorResponse->addChild($oai_node, 'error', $e->getMessage()); $node->setAttribute('code', $e->getOAI2Code()); } @@ -72,11 +72,11 @@ class OAI2Server { public function Identify() { if (count($this->args) > 0) { - foreach($this->args as $key => $val) { + foreach ($this->args as $key => $val) { $this->errors[] = new OAI2Exception('badArgument'); } } else { - foreach($this->identifyResponse as $key => $val) { + foreach ($this->identifyResponse as $key => $val) { $this->response->addToVerbNode($key, $val); } } @@ -94,7 +94,7 @@ class OAI2Server { if (empty($this->errors)) { try { if ($formats = call_user_func($this->listMetadataFormatsCallback, $identifier)) { - foreach($formats as $key => $val) { + foreach ($formats as $key => $val) { $cmf = $this->response->addToVerbNode('metadataFormat'); $this->response->addChild($cmf, 'metadataPrefix', $key); $this->response->addChild($cmf, 'schema', $val['schema']); @@ -195,7 +195,7 @@ class OAI2Server { } } if (isset($this->args['set'])) { - $this->errors[] = new OAI2Exception('noSetHierarchy'); + $this->errors[] = new OAI2Exception('noSetHierarchy'); } } if (empty($this->errors)) { @@ -244,7 +244,7 @@ class OAI2Server { list($usec, $sec) = explode(' ', microtime()); $token = ((int)($usec*1000) + (int)($sec*1000)).'_'.$metadataPrefix; $file = fopen($this->token_prefix.$token, 'w'); - if($file == false) { + if ($file == false) { exit('Cannot write resumption token. Writing permission needs to be changed.'); } fputs($file, $deliveredRecords.'#'); diff --git a/update.php b/update.php index 7a6d555..a5a5044 100644 --- a/update.php +++ b/update.php @@ -18,7 +18,9 @@ */ // Make this script only executable via commandline interface! -if (php_sapi_name() !== 'cli') exit; +if (php_sapi_name() !== 'cli') { + exit; +} require_once './Configuration/Main.php';