Skip to content

Commit

Permalink
pkp#229 Updated deprecated string interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasraoni committed Apr 15, 2023
1 parent 83ebce7 commit 9698652
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions OrcidProfilePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ public function logError($message)
private static function writeLog($message, $level)
{
$fineStamp = date('Y-m-d H:i:s') . substr(microtime(), 1, 4);
error_log("${fineStamp} ${level} ${message}\n", 3, self::logFilePath());
error_log("{$fineStamp} {$level} {$message}\n", 3, self::logFilePath());
}

/**
Expand Down Expand Up @@ -1219,7 +1219,7 @@ public function sendSubmissionToOrcid($publication, $request)
$orcid = basename(parse_url($author->getOrcid(), PHP_URL_PATH));
$authorsWithOrcid[$orcid] = $author;
} else {
$this->logError("Token expired on ${orcidAccessExpiresOn} for author " . $author->getId() . ', deleting orcidAccessToken!');
$this->logError("Token expired on {$orcidAccessExpiresOn} for author " . $author->getId() . ', deleting orcidAccessToken!');
$this->removeOrcidAccessToken($author);
}
}
Expand Down Expand Up @@ -1254,7 +1254,7 @@ public function sendSubmissionToOrcid($publication, $request)
'Authorization' => 'Bearer ' . $author->getData('orcidAccessToken')
];

$this->logInfo("${method} ${uri}");
$this->logInfo("{$method} {$uri}");
$this->logInfo('Header: ' . var_export($headers, true));

$httpClient = Application::get()->getHttpClient();
Expand All @@ -1269,24 +1269,24 @@ public function sendSubmissionToOrcid($publication, $request)
);
} catch (ClientException $exception) {
$reason = $exception->getResponse()->getBody(false);
$this->logInfo("Publication fail: ${reason}");
$this->logInfo("Publication fail: {$reason}");
return new JSONMessage(false);
}
$httpstatus = $response->getStatusCode();
$this->logInfo("Response status: ${httpstatus}");
$this->logInfo("Response status: {$httpstatus}");
$responseHeaders = $response->getHeaders();

switch ($httpstatus) {
case 200:
// Work updated
$this->logInfo("Work updated in profile, putCode: ${putCode}");
$this->logInfo("Work updated in profile, putCode: {$putCode}");
$requestsSuccess[$orcid] = true;
break;
case 201:
$location = $responseHeaders['Location'][0];
// Extract the ORCID work put code for updates/deletion.
$putCode = intval(basename(parse_url($location, PHP_URL_PATH)));
$this->logInfo("Work added to profile, putCode: ${putCode}");
$this->logInfo("Work added to profile, putCode: {$putCode}");
$author->setData('orcidWorkPutCode', $putCode);
Repo::author()->dao->update($author);
$requestsSuccess[$orcid] = true;
Expand All @@ -1312,7 +1312,7 @@ public function sendSubmissionToOrcid($publication, $request)
Repo::author()->dao->update($author);
$requestsSuccess[$orcid] = false;
} else {
$this->logError("Unexpected status ${httpstatus} response, body: " . $response->getBody());
$this->logError("Unexpected status {$httpstatus} response, body: " . $response->getBody());
$requestsSuccess[$orcid] = false;
}
break;
Expand All @@ -1321,7 +1321,7 @@ public function sendSubmissionToOrcid($publication, $request)
$requestsSuccess[$orcid] = false;
break;
default:
$this->logError("Unexpected status ${httpstatus} response, body: " . $response->getBody());
$this->logError("Unexpected status {$httpstatus} response, body: " . $response->getBody());
$requestsSuccess[$orcid] = false;
}
}
Expand Down

0 comments on commit 9698652

Please sign in to comment.