Fix Codacy Code Style Issues
This commit is contained in:
parent
4a6ce98df4
commit
30e3d8bf69
|
@ -44,7 +44,7 @@ class OAI2Response {
|
||||||
if (!empty($this->verb)) {
|
if (!empty($this->verb)) {
|
||||||
$request->setAttribute('verb', $this->verb);
|
$request->setAttribute('verb', $this->verb);
|
||||||
}
|
}
|
||||||
foreach($request_args as $key => $value) {
|
foreach ($request_args as $key => $value) {
|
||||||
$request->setAttribute($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.
|
* 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) {
|
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');
|
$header_node = $this->addToVerbNode('header');
|
||||||
} else {
|
} else {
|
||||||
$header_node = $this->addChild($add_to_node, 'header');
|
$header_node = $this->addChild($add_to_node, 'header');
|
||||||
}
|
}
|
||||||
$this->addChild($header_node, 'identifier', $identifier);
|
$this->addChild($header_node, 'identifier', $identifier);
|
||||||
$this->addChild($header_node, 'datestamp', $timestamp);
|
$this->addChild($header_node, 'datestamp', $timestamp);
|
||||||
if($deleted) {
|
if ($deleted) {
|
||||||
$header_node->setAttribute('status', 'deleted');
|
$header_node->setAttribute('status', 'deleted');
|
||||||
}
|
}
|
||||||
return $header_node;
|
return $header_node;
|
||||||
|
@ -114,7 +114,7 @@ class OAI2Response {
|
||||||
*/
|
*/
|
||||||
public function createResumptionToken($token, $expirationdatetime, $num_rows, $cursor = null) {
|
public function createResumptionToken($token, $expirationdatetime, $num_rows, $cursor = null) {
|
||||||
$resump_node = $this->addChild($this->verbNode, 'resumptionToken', $token);
|
$resump_node = $this->addChild($this->verbNode, 'resumptionToken', $token);
|
||||||
if(isset($expirationdatetime)) {
|
if (isset($expirationdatetime)) {
|
||||||
$resump_node->setAttribute('expirationDate', $expirationdatetime);
|
$resump_node->setAttribute('expirationDate', $expirationdatetime);
|
||||||
}
|
}
|
||||||
$resump_node->setAttribute('completeListSize', $num_rows);
|
$resump_node->setAttribute('completeListSize', $num_rows);
|
||||||
|
|
|
@ -63,7 +63,7 @@ class OAI2Server {
|
||||||
}
|
}
|
||||||
$errorResponse = new OAI2Response($this->uri, $this->verb, $this->args);
|
$errorResponse = new OAI2Response($this->uri, $this->verb, $this->args);
|
||||||
$oai_node = $errorResponse->doc->documentElement;
|
$oai_node = $errorResponse->doc->documentElement;
|
||||||
foreach($this->errors as $e) {
|
foreach ($this->errors as $e) {
|
||||||
$node = $errorResponse->addChild($oai_node, 'error', $e->getMessage());
|
$node = $errorResponse->addChild($oai_node, 'error', $e->getMessage());
|
||||||
$node->setAttribute('code', $e->getOAI2Code());
|
$node->setAttribute('code', $e->getOAI2Code());
|
||||||
}
|
}
|
||||||
|
@ -72,11 +72,11 @@ class OAI2Server {
|
||||||
|
|
||||||
public function Identify() {
|
public function Identify() {
|
||||||
if (count($this->args) > 0) {
|
if (count($this->args) > 0) {
|
||||||
foreach($this->args as $key => $val) {
|
foreach ($this->args as $key => $val) {
|
||||||
$this->errors[] = new OAI2Exception('badArgument');
|
$this->errors[] = new OAI2Exception('badArgument');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach($this->identifyResponse as $key => $val) {
|
foreach ($this->identifyResponse as $key => $val) {
|
||||||
$this->response->addToVerbNode($key, $val);
|
$this->response->addToVerbNode($key, $val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ class OAI2Server {
|
||||||
if (empty($this->errors)) {
|
if (empty($this->errors)) {
|
||||||
try {
|
try {
|
||||||
if ($formats = call_user_func($this->listMetadataFormatsCallback, $identifier)) {
|
if ($formats = call_user_func($this->listMetadataFormatsCallback, $identifier)) {
|
||||||
foreach($formats as $key => $val) {
|
foreach ($formats as $key => $val) {
|
||||||
$cmf = $this->response->addToVerbNode('metadataFormat');
|
$cmf = $this->response->addToVerbNode('metadataFormat');
|
||||||
$this->response->addChild($cmf, 'metadataPrefix', $key);
|
$this->response->addChild($cmf, 'metadataPrefix', $key);
|
||||||
$this->response->addChild($cmf, 'schema', $val['schema']);
|
$this->response->addChild($cmf, 'schema', $val['schema']);
|
||||||
|
@ -195,7 +195,7 @@ class OAI2Server {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($this->args['set'])) {
|
if (isset($this->args['set'])) {
|
||||||
$this->errors[] = new OAI2Exception('noSetHierarchy');
|
$this->errors[] = new OAI2Exception('noSetHierarchy');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($this->errors)) {
|
if (empty($this->errors)) {
|
||||||
|
@ -244,7 +244,7 @@ class OAI2Server {
|
||||||
list($usec, $sec) = explode(' ', microtime());
|
list($usec, $sec) = explode(' ', microtime());
|
||||||
$token = ((int)($usec*1000) + (int)($sec*1000)).'_'.$metadataPrefix;
|
$token = ((int)($usec*1000) + (int)($sec*1000)).'_'.$metadataPrefix;
|
||||||
$file = fopen($this->token_prefix.$token, 'w');
|
$file = fopen($this->token_prefix.$token, 'w');
|
||||||
if($file == false) {
|
if ($file == false) {
|
||||||
exit('Cannot write resumption token. Writing permission needs to be changed.');
|
exit('Cannot write resumption token. Writing permission needs to be changed.');
|
||||||
}
|
}
|
||||||
fputs($file, $deliveredRecords.'#');
|
fputs($file, $deliveredRecords.'#');
|
||||||
|
|
|
@ -18,7 +18,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Make this script only executable via commandline interface!
|
// 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';
|
require_once './Configuration/Main.php';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue