Open Journal Systems
3.3.0
Util/Factory.php
1
<?php
2
/*
3
* citeproc-php
4
*
5
* @link http://github.com/seboettg/citeproc-php for the source repository
6
* @copyright Copyright (c) 2016 Sebastian Böttger.
7
* @license https://opensource.org/licenses/MIT
8
*/
9
10
namespace
Seboettg\CiteProc\Util
;
11
12
use
Seboettg\CiteProc\Exception\InvalidStylesheetException
;
13
use SimpleXMLElement;
14
21
class
Factory
22
{
23
const
CITE_PROC_NODE_NAMESPACE
=
"Seboettg\\CiteProc\\Rendering"
;
24
28
private
static
$nodes = [
29
30
'layout'
=>
"\\Layout"
,
31
'text'
=>
"\\Text"
,
32
"macro"
=>
"\\Macro"
,
33
"number"
=>
"\\Number"
,
34
"label"
=>
"\\Label"
,
35
"group"
=>
"\\Group"
,
36
"choose"
=>
"\\Choose\\Choose"
,
37
"if"
=>
"\\Choose\\ChooseIf"
,
38
"else-if"
=>
"\\Choose\\ChooseElseIf"
,
39
"else"
=>
"\\Choose\\ChooseElse"
,
40
'date'
=>
"\\Date\\Date"
,
41
"date-part"
=>
"\\Date\\DatePart"
,
42
"names"
=>
"\\Name\\Names"
,
43
"name"
=>
"\\Name\\Name"
,
44
"name-part"
=>
"\\Name\\NamePart"
,
45
"substitute"
=>
"\\Name\\Substitute"
,
46
"et-al"
=>
"\\Name\\EtAl"
47
];
48
55
public
static
function
create
($node, $param =
null
)
56
{
57
$nodeClass = self::CITE_PROC_NODE_NAMESPACE.self::$nodes[$node->getName()];
58
if
(!class_exists($nodeClass)) {
59
throw
new
InvalidStylesheetException
(
"For node {$node->getName()} "
.
60
"does not exist any counterpart class \""
.$nodeClass.
61
"\". The given stylesheet seems to be invalid."
);
62
}
63
if
($param !=
null
) {
64
return
new
$nodeClass($node, $param);
65
}
66
return
new
$nodeClass($node);
67
}
68
}
Seboettg\CiteProc\Exception\InvalidStylesheetException
Definition:
InvalidStylesheetException.php:10
Seboettg\CiteProc\Util
Definition:
CiteProcHelper.php:10
Seboettg\CiteProc\Util\Factory\CITE_PROC_NODE_NAMESPACE
const CITE_PROC_NODE_NAMESPACE
Definition:
Util/Factory.php:23
Seboettg\CiteProc\Util\Factory
Definition:
Util/Factory.php:21
Seboettg\CiteProc\Util\Factory\create
static create($node, $param=null)
Definition:
Util/Factory.php:55
plugins
generic
citationStyleLanguage
lib
vendor
seboettg
citeproc-php
src
Util
Factory.php
Generated on Fri Aug 28 2020 14:51:47 for Open Journal Systems by
1.8.17