O3PO_Bibentry
in package
A class to represent bibliography entries.
Tags
Table of Contents
Properties
- $meta_data : array<string|int, mixed>
- Array holding the meta-data of this bibtentry
- $meta_data_fields : array<string|int, mixed>
- Array of all supported meta-data fields
Methods
- __construct() : mixed
- Construct a bibtentry.
- get() : mixed
- Get the value of a given field
- get_cite_as_text() : string
- How to cite this bibentry.
- get_formated_authors() : string
- Formated author and editor list
- get_formated_html() : string
- HTML representation of the bibentry.
- get_surnames() : string
- Oxford comma separated list of all author and editor surnames.
- match() : bool
- Compare two bibentries.
- merge() : O3PO_Bibentry
- Merge two bibentries.
- merge_bibitem_arrays() : array<string|int, mixed>
- Merge two arrays of bibentries.
- remove_duplicates() : mixed
- Remove duplicates from an array of bibentries.
Properties
$meta_data
Array holding the meta-data of this bibtentry
private
array<string|int, mixed>
$meta_data
Array holding the meta-data of this bibtentry.
Tags
$meta_data_fields
Array of all supported meta-data fields
private
static array<string|int, mixed>
$meta_data_fields
= array('authors', 'chapter', 'collectiontitle', 'day', 'doi', 'editors', 'eprint', 'howpublished', 'institution', 'isbn', 'issn', 'issue', 'month', 'page', 'publisher', 'ref', 'title', 'type', 'url', 'venue', 'volume', 'year')
of all supported meta-data fields
Tags
Methods
__construct()
Construct a bibtentry.
public
__construct([array<string|int, mixed> $meta_data = array() ]) : mixed
Only the entries in $meta_data whose keys are listed in $meta_data_fields are taken into account. All fields that are not arrays are converted to string. Fields that are in $meta_data_fields but for which no data is provided are initialized to an empty string.
Parameters
- $meta_data : array<string|int, mixed> = array()
-
The meta-data to store in this bibentry
Tags
get()
Get the value of a given field
public
get(string $field) : mixed
Parameters
- $field : string
-
The key of the field to get.
Tags
Return values
mixed —The string or array stored in the field.
get_cite_as_text()
How to cite this bibentry.
public
get_cite_as_text() : string
Tags
Return values
string —Text describing how to cite this bibentry.
get_formated_authors()
Formated author and editor list
public
get_formated_authors() : string
Editors are indicated with the string Editor: or Editors: before their names
Tags
Return values
string —Oxford comma separated list of all authors and editors.
get_formated_html()
HTML representation of the bibentry.
public
get_formated_html(mixed $doi_url_prefix, mixed $arxiv_url_abs_prefix) : string
Parameters
- $doi_url_prefix : mixed
-
Prefix to use for DOI links.
- $arxiv_url_abs_prefix : mixed
-
Prefix to use for arXiv links.
Tags
Return values
string —HTHL representation of the bibentry.
get_surnames()
Oxford comma separated list of all author and editor surnames.
public
get_surnames() : string
Tags
Return values
string —Oxford comma separated list of all author surnames.
match()
Compare two bibentries.
public
static match(O3PO_Bibentry $bibitem1, O3PO_Bibentry $bibitem2) : bool
Parameters
- $bibitem1 : O3PO_Bibentry
-
First bibentry to match.
- $bibitem2 : O3PO_Bibentry
-
First bibentry to match.
Tags
Return values
bool —True if bibentries are considered similar enough to probably represent the same bibliographic item, false otherwise.
merge()
Merge two bibentries.
public
static merge(O3PO_Bibentry $bibitem1, O3PO_Bibentry $bibitem2) : O3PO_Bibentry
Bibentries are merged field wise, in case of collisions $bibitem1 takes preference over $bibitem2.
Parameters
- $bibitem1 : O3PO_Bibentry
-
First bibentry to merge.
- $bibitem2 : O3PO_Bibentry
-
First bibentry to merge.
Tags
Return values
O3PO_Bibentry —Merged bibentry.
merge_bibitem_arrays()
Merge two arrays of bibentries.
public
static merge_bibitem_arrays(array<string|int, mixed> $array1, array<string|int, mixed> $array2[, bool $remove_dulicates = true ]) : array<string|int, mixed>
Merges $array2 into $array1. The content of the entries in $array1 takes preference over those in $array2, entries in $array2 that were not merged are appended at the end. Array keys in $array1 are preserved.
If $remove_dulicates is true all duplicates are removed from the final array by merging them into the first matching entry. Non-removed array keys are preserved.
Parameters
- $array1 : array<string|int, mixed>
-
First array of bibtentries.
- $array2 : array<string|int, mixed>
-
Second array of bibtentries.
- $remove_dulicates : bool = true
-
Whether to remove duplicates.
Return values
array<string|int, mixed> —Merged array of bibentries.
remove_duplicates()
Remove duplicates from an array of bibentries.
public
static remove_duplicates(array<string|int, mixed> $array[, bool $merge = false ]) : mixed
Duplicates are identified by comparing pairs with the help of match().
Parameters
- $array : array<string|int, mixed>
-
Array of bibentries from which duplicates are to be removed.
- $merge : bool = false
-
Whether to merge duplicates or simply discard them.