first test datacite schema
This commit is contained in:
parent
d0ed3e9105
commit
3c50618c8a
8 changed files with 411 additions and 99 deletions
42
app/Models/Oai/OaiModelError.php
Normal file
42
app/Models/Oai/OaiModelError.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models\Oai;
|
||||
|
||||
class OaiModelError
|
||||
{
|
||||
/**
|
||||
* Define all valid error codes.
|
||||
*/
|
||||
const BADVERB = 1010;
|
||||
const BADARGUMENT = 1011;
|
||||
const CANNOTDISSEMINATEFORMAT = 1012;
|
||||
const BADRESUMPTIONTOKEN = 1013;
|
||||
const NORECORDSMATCH = 1014;
|
||||
const IDDOESNOTEXIST = 1015;
|
||||
/**
|
||||
* Holds OAI error codes for internal error numbers.
|
||||
*
|
||||
* @var array Valid OAI parameters.
|
||||
*/
|
||||
protected static $oaiErrorCodes = array(
|
||||
self::BADVERB => 'badVerb',
|
||||
self::BADARGUMENT => 'badArgument',
|
||||
self::NORECORDSMATCH => 'noRecordsMatch',
|
||||
self::CANNOTDISSEMINATEFORMAT => 'cannotDisseminateFormat',
|
||||
self::BADRESUMPTIONTOKEN => 'badResumptionToken',
|
||||
self::IDDOESNOTEXIST => 'idDoesNotExist',
|
||||
);
|
||||
/**
|
||||
* Map internal error codes to OAI error codes.
|
||||
*
|
||||
* @param int $code Internal error code.
|
||||
* @return string OAI error code.
|
||||
*/
|
||||
public static function mapCode($code)
|
||||
{
|
||||
if (false === array_key_exists($code, self::$oaiErrorCodes)) {
|
||||
throw new Oai_Model_Exception("Unknown oai error code $code");
|
||||
}
|
||||
return self::$oaiErrorCodes[$code];
|
||||
}
|
||||
}
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue