-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathReference.php
More file actions
142 lines (117 loc) · 3.85 KB
/
Reference.php
File metadata and controls
142 lines (117 loc) · 3.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php
/*
* Copyright (C) 2025 PREBI-SEDICI, Universidad Nacional de La Plata
* Licensed under GPLv3: see LICENSE file for details.
*/
include_once 'Expression/Analyzers/AuthorAnalyzer/AuthorExpression.php';
include_once 'Expression/Analyzers/DateAnalyzer/DateExpression.php';
include_once 'Expression/Analyzers/TitleAnalyzer/TitleExpression.php';
include_once 'Expression/Analyzers/UrlAnalyzer/URLExpression.php';
include_once 'Printer/BookPrinter.php';
include_once 'Printer/JournalPrinter.php';
include_once 'Printer/ChapterPrinter.php';
include_once 'Printer/ConfprocPrinter.php';
include_once 'Printer/DatePrinter.php';
include_once 'Printer/AuthorPrinter.php';
include_once 'Printer/ThesisPrinter.php';
include_once 'Printer/URLPrinter.php';
include_once 'Printer/DOIPrinter.php';
include_once 'Printer/HANDLEPrinter.php';
include_once 'Printer/WebpagePrinter.php';
class Reference {
private $plainTextReference;
private $type;
public $author;
public $authorType;
public $title;
public $titleType;
public $date;
public $dateType;
public $url;
public $urlType;
public function __construct(string $plainTextReference) {
$this->plainTextReference = $plainTextReference;
$this->type = [];
$this->parse();
}
private function parseAuthor() {
$authorExpression = $this->author = AuthorExpression::parse($this->plainTextReference);
$this->author = $authorExpression['value'];
$this->authorType = $authorExpression['expression'];
}
private function parseDate() {
$dateExpression = DateExpression::parse($this->plainTextReference);
$this->date = $dateExpression['value'];
$this->dateType = $dateExpression['expression'];
if ($dateExpression['expression'] === 'congress') {
$this->type[] = $dateExpression['expression'];
}
}
private function parseTitle() {
$titleExpression = TitleExpression::parse($this->plainTextReference, $this->type);
$this->title = $titleExpression['value'];
$this->type = $titleExpression['expression'];
$this->titleType = $titleExpression['expression'];
}
private function parseURL() {
$URLExpression = URLExpression::parse($this->plainTextReference);
$this->url = $URLExpression['value'];
$this->urlType = $URLExpression['expression'];
}
private function parse() {
$this->parseAuthor();
$this->parseDate();
$this->parseURL();
$this->parseTitle();
}
// Getter para author
public function merge(): array {
// Usando array_merge para combinar los arreglos
$combinedArray = array_merge($this->author, $this->title, $this->date, $this->url);
return $combinedArray;
}
// Getter para author
public function getType() {
return $this->type;
}
public function getPlainTextReference() {
return $this->plainTextReference;
}
// Getter para author
public function getAuthor() {
return $this->author;
}
// Getter para authorType
public function getAuthorType() {
return $this->authorType;
}
// Getter para title
public function getTitle() {
return $this->title;
}
// Getter para titleType
public function getTitleType() {
return $this->titleType;
}
// Getter para date
public function getDate() {
return $this->date;
}
// Getter para dateType
public function getDateType() {
return $this->dateType;
}
// Getter para date
public function getURL() {
return $this->url;
}
// Getter para dateType
public function getURLType() {
return $this->urlType;
}
private function determineType() {
if ($this->type === null) {
// Lógica para determinar el tipo de referencia
}
}
}