@@ -12,8 +12,8 @@ |
||
12 | 12 | { |
13 | 13 | foreach ($node->attributes() as $attribute) { |
14 | 14 | /** @var string $name */ |
15 | - $name = (string)$attribute->getName(); |
|
16 | - $value = (string)$attribute; |
|
15 | + $name = (string) $attribute->getName(); |
|
16 | + $value = (string) $attribute; |
|
17 | 17 | |
18 | 18 | switch ($name) { |
19 | 19 | case 'delimiter': |
@@ -14,103 +14,103 @@ |
||
14 | 14 | { |
15 | 15 | |
16 | 16 | const NAME_VARIABLES = [ |
17 | - 'author', //author |
|
18 | - 'collection-editor', //editor of the collection holding the item (e.g. the series editor for a book) |
|
19 | - 'composer', //composer (e.g. of a musical score) |
|
20 | - 'container-author', //author of the container holding the item (e.g. the book author for a book chapter) |
|
21 | - 'director', //director (e.g. of a film) |
|
22 | - 'editor', //editor |
|
23 | - 'editorial-director', //managing editor (“Directeur de la Publication” in French) |
|
24 | - 'illustrator', //illustrator (e.g. of a children’s book) |
|
25 | - 'interviewer', //interviewer (e.g. of an interview) |
|
26 | - 'original-author', // |
|
27 | - 'recipient', //recipient (e.g. of a letter) |
|
17 | + 'author', //author |
|
18 | + 'collection-editor', //editor of the collection holding the item (e.g. the series editor for a book) |
|
19 | + 'composer', //composer (e.g. of a musical score) |
|
20 | + 'container-author', //author of the container holding the item (e.g. the book author for a book chapter) |
|
21 | + 'director', //director (e.g. of a film) |
|
22 | + 'editor', //editor |
|
23 | + 'editorial-director', //managing editor (“Directeur de la Publication” in French) |
|
24 | + 'illustrator', //illustrator (e.g. of a children’s book) |
|
25 | + 'interviewer', //interviewer (e.g. of an interview) |
|
26 | + 'original-author', // |
|
27 | + 'recipient', //recipient (e.g. of a letter) |
|
28 | 28 | 'reviewed-author' //author of the item reviewed by the current item |
29 | 29 | ]; |
30 | 30 | |
31 | 31 | const NUMBER_VARIABLES = [ |
32 | - 'chapter-number', //chapter number |
|
33 | - 'collection-number', //number identifying the collection holding the item (e.g. the series number for a book) |
|
34 | - 'edition', //(container) edition holding the item (e.g. “3” when citing a chapter in the third |
|
32 | + 'chapter-number', //chapter number |
|
33 | + 'collection-number', //number identifying the collection holding the item (e.g. the series number for a book) |
|
34 | + 'edition', //(container) edition holding the item (e.g. “3” when citing a chapter in the third |
|
35 | 35 | //edition of a book) |
36 | - 'issue', //(container) issue holding the item (e.g. “5” when citing a journal article from |
|
36 | + 'issue', //(container) issue holding the item (e.g. “5” when citing a journal article from |
|
37 | 37 | //journal volume 2, issue 5) |
38 | - 'number', //number identifying the item (e.g. a report number) |
|
39 | - 'number-of-pages', //total number of pages of the cited item |
|
40 | - 'number-of-volumes', //total number of volumes, usable for citing multi-volume books and such |
|
38 | + 'number', //number identifying the item (e.g. a report number) |
|
39 | + 'number-of-pages', //total number of pages of the cited item |
|
40 | + 'number-of-volumes', //total number of volumes, usable for citing multi-volume books and such |
|
41 | 41 | 'volume' //(container) volume holding the item (e.g. “2” when citing a chapter from book volume 2) |
42 | 42 | ]; |
43 | 43 | |
44 | 44 | const DATE_VARIABLES = [ |
45 | - 'accessed', //date the item has been accessed |
|
45 | + 'accessed', //date the item has been accessed |
|
46 | 46 | 'container', |
47 | - 'event-date', //date the related event took place |
|
48 | - 'issued', //date the item was issued/published |
|
49 | - 'original-date', //(issue) date of the original version |
|
47 | + 'event-date', //date the related event took place |
|
48 | + 'issued', //date the item was issued/published |
|
49 | + 'original-date', //(issue) date of the original version |
|
50 | 50 | 'submitted' //date the item (e.g. a manuscript) has been submitted for publication |
51 | 51 | ]; |
52 | 52 | |
53 | 53 | const STANDARD_VARIABLE = [ |
54 | - 'abstract', //abstract of the item (e.g. the abstract of a journal article) |
|
55 | - 'annote', //reader’s notes about the item content |
|
56 | - 'archive', //archive storing the item |
|
57 | - 'archive-location', //storage location within an archive (e.g. a box and folder number) |
|
58 | - 'archive-place', //geographic location of the archive |
|
59 | - 'authority', //issuing or judicial authority (e.g. “USPTO” for a patent, “Fairfax Circuit Court” for |
|
54 | + 'abstract', //abstract of the item (e.g. the abstract of a journal article) |
|
55 | + 'annote', //reader’s notes about the item content |
|
56 | + 'archive', //archive storing the item |
|
57 | + 'archive-location', //storage location within an archive (e.g. a box and folder number) |
|
58 | + 'archive-place', //geographic location of the archive |
|
59 | + 'authority', //issuing or judicial authority (e.g. “USPTO” for a patent, “Fairfax Circuit Court” for |
|
60 | 60 | //a legal case) |
61 | - 'call-number', //call number (to locate the item in a library) |
|
62 | - 'citation-label', //label identifying the item in in-text citations of label styles (e.g. “Ferr78”). May |
|
61 | + 'call-number', //call number (to locate the item in a library) |
|
62 | + 'citation-label', //label identifying the item in in-text citations of label styles (e.g. “Ferr78”). May |
|
63 | 63 | //be assigned by the CSL processor based on item metadata. |
64 | - 'citation-number', //index (starting at 1) of the cited reference in the bibliography (generated by the CSL |
|
64 | + 'citation-number', //index (starting at 1) of the cited reference in the bibliography (generated by the CSL |
|
65 | 65 | //processor) |
66 | - 'collection-title', //title of the collection holding the item (e.g. the series title for a book) |
|
67 | - 'container-title', //title of the container holding the item (e.g. the book title for a book chapter, the |
|
66 | + 'collection-title', //title of the collection holding the item (e.g. the series title for a book) |
|
67 | + 'container-title', //title of the container holding the item (e.g. the book title for a book chapter, the |
|
68 | 68 | //journal title for a journal article) |
69 | - 'container-title-short',//short/abbreviated form of “container-title” (also accessible through the “short” form |
|
69 | + 'container-title-short', //short/abbreviated form of “container-title” (also accessible through the “short” form |
|
70 | 70 | //of the “container-title” variable) |
71 | - 'dimensions', //physical (e.g. size) or temporal (e.g. running time) dimensions of the item |
|
72 | - 'DOI', //Digital Object Identifier (e.g. “10.1128/AEM.02591-07”) |
|
73 | - 'event', //name of the related event (e.g. the conference name when citing a conference paper) |
|
74 | - 'event-place', //geographic location of the related event (e.g. “Amsterdam, the Netherlands”) |
|
71 | + 'dimensions', //physical (e.g. size) or temporal (e.g. running time) dimensions of the item |
|
72 | + 'DOI', //Digital Object Identifier (e.g. “10.1128/AEM.02591-07”) |
|
73 | + 'event', //name of the related event (e.g. the conference name when citing a conference paper) |
|
74 | + 'event-place', //geographic location of the related event (e.g. “Amsterdam, the Netherlands”) |
|
75 | 75 | 'first-reference-note-number', //number of a preceding note containing the first reference to the item. Assigned |
76 | 76 | // by the CSL processor. The variable holds no value for non-note-based styles, or when |
77 | 77 | // the item hasn’t been cited in any preceding notes. |
78 | - 'genre', //class, type or genre of the item (e.g. “adventure” for an adventure movie, |
|
78 | + 'genre', //class, type or genre of the item (e.g. “adventure” for an adventure movie, |
|
79 | 79 | //“PhD dissertation” for a PhD thesis), |
80 | - 'ISBN', //International Standard Book Number |
|
81 | - 'ISSN', //International Standard Serial Number |
|
82 | - 'jurisdiction', //geographic scope of relevance (e.g. “US” for a US patent) |
|
83 | - 'keyword', //keyword(s) or tag(s) attached to the item |
|
84 | - 'locator', //a cite-specific pinpointer within the item (e.g. a page number within a book, or a |
|
80 | + 'ISBN', //International Standard Book Number |
|
81 | + 'ISSN', //International Standard Serial Number |
|
82 | + 'jurisdiction', //geographic scope of relevance (e.g. “US” for a US patent) |
|
83 | + 'keyword', //keyword(s) or tag(s) attached to the item |
|
84 | + 'locator', //a cite-specific pinpointer within the item (e.g. a page number within a book, or a |
|
85 | 85 | //volume in a multi-volume work). Must be accompanied in the input data by a label |
86 | 86 | //indicating the locator type (see the Locators term list), which determines which term |
87 | 87 | //is rendered by cs:label when the “locator” variable is selected. |
88 | - 'medium', //medium description (e.g. “CD”, “DVD”, etc.) |
|
89 | - 'note', //(short) inline note giving additional item details (e.g. a concise summary or commentary) |
|
90 | - 'original-publisher', //original publisher, for items that have been republished by a different publisher |
|
88 | + 'medium', //medium description (e.g. “CD”, “DVD”, etc.) |
|
89 | + 'note', //(short) inline note giving additional item details (e.g. a concise summary or commentary) |
|
90 | + 'original-publisher', //original publisher, for items that have been republished by a different publisher |
|
91 | 91 | 'original-publisher-place', //geographic location of the original publisher (e.g. “London, UK”) |
92 | - 'original-title', //title of the original version (e.g. “Война и мир”, the untranslated Russian title of |
|
92 | + 'original-title', //title of the original version (e.g. “Война и мир”, the untranslated Russian title of |
|
93 | 93 | // “War and Peace”) |
94 | - 'page', //range of pages the item (e.g. a journal article) covers in a container (e.g. a journal |
|
94 | + 'page', //range of pages the item (e.g. a journal article) covers in a container (e.g. a journal |
|
95 | 95 | // issue) |
96 | - 'page-first', //first page of the range of pages the item (e.g. a journal article) covers in a |
|
96 | + 'page-first', //first page of the range of pages the item (e.g. a journal article) covers in a |
|
97 | 97 | //container (e.g. a journal issue) |
98 | - 'PMCID', //PubMed Central reference number |
|
99 | - 'PMID', //PubMed reference number |
|
100 | - 'publisher', //publisher |
|
101 | - 'publisher-place', //geographic location of the publisher |
|
102 | - 'references', //resources related to the procedural history of a legal case |
|
103 | - 'reviewed-title', //title of the item reviewed by the current item |
|
104 | - 'scale', //scale of e.g. a map |
|
105 | - 'section', //container section holding the item (e.g. “politics” for a newspaper article) |
|
106 | - 'source', //from whence the item originates (e.g. a library catalog or database) |
|
107 | - 'status', //(publication) status of the item (e.g. “forthcoming”) |
|
108 | - 'title', //primary title of the item |
|
109 | - 'title-short', //short/abbreviated form of “title” (also accessible through the “short” form of the |
|
98 | + 'PMCID', //PubMed Central reference number |
|
99 | + 'PMID', //PubMed reference number |
|
100 | + 'publisher', //publisher |
|
101 | + 'publisher-place', //geographic location of the publisher |
|
102 | + 'references', //resources related to the procedural history of a legal case |
|
103 | + 'reviewed-title', //title of the item reviewed by the current item |
|
104 | + 'scale', //scale of e.g. a map |
|
105 | + 'section', //container section holding the item (e.g. “politics” for a newspaper article) |
|
106 | + 'source', //from whence the item originates (e.g. a library catalog or database) |
|
107 | + 'status', //(publication) status of the item (e.g. “forthcoming”) |
|
108 | + 'title', //primary title of the item |
|
109 | + 'title-short', //short/abbreviated form of “title” (also accessible through the “short” form of the |
|
110 | 110 | //“title” variable) |
111 | - 'URL', //Uniform Resource Locator (e.g. “http://aem.asm.org/cgi/content/full/74/9/2766”) |
|
112 | - 'version', //version of the item (e.g. “2.0.9” for a software program) |
|
113 | - 'year-suffix', //disambiguating year suffix in author-date styles (e.g. “a” in “Doe, 1999a”) |
|
111 | + 'URL', //Uniform Resource Locator (e.g. “http://aem.asm.org/cgi/content/full/74/9/2766”) |
|
112 | + 'version', //version of the item (e.g. “2.0.9” for a software program) |
|
113 | + 'year-suffix', //disambiguating year suffix in author-date styles (e.g. “a” in “Doe, 1999a”) |
|
114 | 114 | |
115 | 115 | |
116 | 116 | ]; |
@@ -30,11 +30,11 @@ |
||
30 | 30 | { |
31 | 31 | $nameParts = explode("-", $name); |
32 | 32 | $attr = ""; |
33 | - for ($i = count($nameParts)-1; $i >= 0; --$i) { |
|
33 | + for ($i = count($nameParts) - 1; $i >= 0; --$i) { |
|
34 | 34 | if ($i > 0) { |
35 | 35 | $attr = ucfirst($nameParts[$i]) . $attr; |
36 | 36 | } else { |
37 | - $attr = $nameParts[$i].$attr; |
|
37 | + $attr = $nameParts[$i] . $attr; |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | if (!isset($this->{$attr})) { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public static function getCompareNumber() |
59 | 59 | { |
60 | - return function ($numA, $numB, $order) { |
|
60 | + return function($numA, $numB, $order) { |
|
61 | 61 | if (is_numeric($numA) && is_numeric($numB)) { |
62 | 62 | $ret = $numA - $numB; |
63 | 63 | } else { |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | "I" => 1 |
139 | 139 | ]; |
140 | 140 | |
141 | - if(is_numeric($romanNumber)) { |
|
141 | + if (is_numeric($romanNumber)) { |
|
142 | 142 | return 0; |
143 | 143 | } |
144 | 144 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | $sum = 0; |
155 | - while($current = current($values)) { |
|
155 | + while ($current = current($values)) { |
|
156 | 156 | $next = next($values); |
157 | 157 | $next > $current ? $sum += $next - $current + 0 * next($values) : $sum += $current; |
158 | 158 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | return $numberFormatter->parse($evalValue) !== false; |
61 | 61 | } else if (preg_match(Number::PATTERN_ROMAN, $evalValue)) { |
62 | 62 | return Number::roman2Dec($evalValue) !== false; |
63 | - } else if (preg_match(Number::PATTERN_COMMA_AMPERSAND_RANGE, $evalValue)){ |
|
63 | + } else if (preg_match(Number::PATTERN_COMMA_AMPERSAND_RANGE, $evalValue)) { |
|
64 | 64 | return true; |
65 | 65 | } |
66 | 66 | return false; |
@@ -58,13 +58,13 @@ |
||
58 | 58 | { |
59 | 59 | foreach ($node->attributes() as $attribute) { |
60 | 60 | if ("name" === $attribute->getName()) { |
61 | - $this->name = (string)$attribute; |
|
61 | + $this->name = (string) $attribute; |
|
62 | 62 | } |
63 | 63 | if ("form" === $attribute->getName()) { |
64 | - $this->form = (string)$attribute; |
|
64 | + $this->form = (string) $attribute; |
|
65 | 65 | } |
66 | 66 | if ("range-delimiter" === $attribute->getName()) { |
67 | - $this->rangeDelimiter = (string)$attribute; |
|
67 | + $this->rangeDelimiter = (string) $attribute; |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 |
@@ -125,9 +125,9 @@ |
||
125 | 125 | */ |
126 | 126 | public function renderNumeric() |
127 | 127 | { |
128 | - $ret = $this->year; |
|
129 | - $ret .= $this->month > 0 && $this->month < 13 ? "-" . sprintf("%02s", $this->month) : ""; |
|
130 | - $ret .= $this->day > 0 && $this->day < 32 ? "-" . sprintf("%02s", $this->day) : ""; |
|
128 | + $ret = $this->year; |
|
129 | + $ret .= $this->month > 0 && $this->month < 13 ? "-" . sprintf("%02s", $this->month) : ""; |
|
130 | + $ret .= $this->day > 0 && $this->day < 32 ? "-" . sprintf("%02s", $this->day) : ""; |
|
131 | 131 | return $ret; |
132 | 132 | } |
133 | 133 | } |
134 | 134 | \ No newline at end of file |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | - * @param array|DataList $data |
|
118 | + * @param DataList $data |
|
119 | 119 | * @return string |
120 | 120 | */ |
121 | 121 | protected function bibliography($data) |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
128 | - * @param array|DataList $data |
|
128 | + * @param DataList $data |
|
129 | 129 | * @return string |
130 | 130 | */ |
131 | 131 | protected function citation($data) |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
257 | - * @param $differentParts |
|
257 | + * @param integer $differentParts |
|
258 | 258 | * @param DateTime $from |
259 | 259 | * @param DateTime $to |
260 | 260 | * @param $delim |
@@ -406,8 +406,8 @@ discard block |
||
406 | 406 | |
407 | 407 | /** |
408 | 408 | * @param $datePart |
409 | - * @param $from |
|
410 | - * @param $to |
|
409 | + * @param DateTime $from |
|
410 | + * @param DateTime $to |
|
411 | 411 | * @param $delim |
412 | 412 | * @return string |
413 | 413 | */ |
@@ -421,6 +421,7 @@ discard block |
||
421 | 421 | } |
422 | 422 | |
423 | 423 | /** |
424 | + * @param string $format |
|
424 | 425 | * @return bool |
425 | 426 | */ |
426 | 427 | private function hasDatePartsFromLocales($format) |
@@ -430,6 +431,7 @@ discard block |
||
430 | 431 | } |
431 | 432 | |
432 | 433 | /** |
434 | + * @param string $format |
|
433 | 435 | * @return array |
434 | 436 | */ |
435 | 437 | private function getDatePartsFromLocales($format) |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | if ($this->dateParts->count() < 1 && in_array($form, self::$localizedDateFormats)) { |
143 | 143 | if ($this->hasDatePartsFromLocales($form)) { |
144 | 144 | $datePartsFromLocales = $this->getDatePartsFromLocales($form); |
145 | - array_filter($datePartsFromLocales, function (\SimpleXMLElement $item) use ($dateParts) { |
|
145 | + array_filter($datePartsFromLocales, function(\SimpleXMLElement $item) use ($dateParts) { |
|
146 | 146 | return in_array($item["name"], $dateParts); |
147 | 147 | }); |
148 | 148 | |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | $ret = $this->renderDateRange($toRender, $from, $to, $delim); |
213 | 213 | } |
214 | 214 | |
215 | - if (isset($var->raw) && preg_match("/(\p{L}+)\s?([\-\-\&,])\s?(\p{L}+)/u", $var->raw, $matches)){ |
|
216 | - return $matches[1].$matches[2].$matches[3]; |
|
215 | + if (isset($var->raw) && preg_match("/(\p{L}+)\s?([\-\-\&,])\s?(\p{L}+)/u", $var->raw, $matches)) { |
|
216 | + return $matches[1] . $matches[2] . $matches[3]; |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | // fallback: |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $data = []; |
243 | 243 | foreach ($dates as $date) { |
244 | 244 | if ($date[0] < 1000) { |
245 | - $dateTime = new DateTime(0,0,0); |
|
245 | + $dateTime = new DateTime(0, 0, 0); |
|
246 | 246 | $dateTime->setDay(0)->setMonth(0)->setYear(0); |
247 | 247 | $data[] = $dateTime; |
248 | 248 | } |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | $dp = $this->dateParts->toArray(); |
348 | 348 | $i = 0; |
349 | 349 | $dateParts_ = []; |
350 | - array_walk($dp, function ($datePart, $key) use (&$i, &$dateParts_, $differentParts) { |
|
350 | + array_walk($dp, function($datePart, $key) use (&$i, &$dateParts_, $differentParts) { |
|
351 | 351 | if (strpos($key, "year") !== false || strpos($key, "month") !== false) { |
352 | 352 | $dateParts_["yearmonth"][] = $datePart; |
353 | 353 | } |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $dp = $this->dateParts->toArray(); |
361 | 361 | $i = 0; |
362 | 362 | $dateParts_ = []; |
363 | - array_walk($dp, function ($datePart, $key) use (&$i, &$dateParts_, $differentParts) { |
|
363 | + array_walk($dp, function($datePart, $key) use (&$i, &$dateParts_, $differentParts) { |
|
364 | 364 | if (strpos($key, "year") !== false || strpos($key, "day") !== false) { |
365 | 365 | $dateParts_["yearday"][] = $datePart; |
366 | 366 | } |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | $dp = $this->dateParts->toArray(); |
374 | 374 | $i = 0; |
375 | 375 | $dateParts_ = []; |
376 | - array_walk($dp, function ($datePart, $key) use (&$i, &$dateParts_, $differentParts) { |
|
376 | + array_walk($dp, function($datePart, $key) use (&$i, &$dateParts_, $differentParts) { |
|
377 | 377 | //$bit = sprintf("%03d", decbin($differentParts)); |
378 | 378 | if (strpos($key, "month") !== false || strpos($key, "day") !== false) { |
379 | 379 | $dateParts_["monthday"][] = $datePart; |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $from = $datePart->renderWithoutAffixes($from, $this); |
424 | 424 | $to = $datePart->renderWithoutAffixes($to, $this); |
425 | 425 | $suffix = !empty($to) ? $datePart->renderSuffix() : ""; |
426 | - return $prefix.$from.$delim.$to.$suffix; |
|
426 | + return $prefix . $from . $delim . $to . $suffix; |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | /** |
@@ -448,9 +448,9 @@ discard block |
||
448 | 448 | // no custom date parts within the date element (this)? |
449 | 449 | if (!empty($dateFromLocale)) { |
450 | 450 | |
451 | - $dateForm = array_filter(is_array($dateFromLocale) ? $dateFromLocale : [$dateFromLocale], function ($element) use ($format) { |
|
451 | + $dateForm = array_filter(is_array($dateFromLocale) ? $dateFromLocale : [$dateFromLocale], function($element) use ($format) { |
|
452 | 452 | /** @var \SimpleXMLElement $element */ |
453 | - $dateForm = (string)$element->attributes()["form"]; |
|
453 | + $dateForm = (string) $element->attributes()["form"]; |
|
454 | 454 | return $dateForm === $format; |
455 | 455 | }); |
456 | 456 |