@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | ); |
161 | 161 | } |
162 | 162 | list($from, $to) = $ranges; |
163 | - return $from . "–" . $to; |
|
163 | + return $from."–".$to; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | return $page; |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | // test case group_ShortOutputOnly.json |
212 | 212 | $value = ""; |
213 | 213 | if (in_array($this->form, ["short", "long"])) { |
214 | - $attrWithPrefix = $this->form . ucfirst($this->toRenderTypeValue); |
|
215 | - $attrWithSuffix = $this->toRenderTypeValue . "-" . $this->form; |
|
214 | + $attrWithPrefix = $this->form.ucfirst($this->toRenderTypeValue); |
|
215 | + $attrWithSuffix = $this->toRenderTypeValue."-".$this->form; |
|
216 | 216 | if (isset($data->{$attrWithPrefix}) && !empty($data->{$attrWithPrefix})) { |
217 | 217 | $value = $data->{$attrWithPrefix}; |
218 | 218 | } else { |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | unset($data->{$this->toRenderTypeValue}); |
114 | 114 | } |
115 | 115 | if (!CiteProcHelper::isUsingAffixesByMarkupExtentsion($data, $this->toRenderTypeValue)) { |
116 | - $renderedText = $this->applyAdditionalMarkupFunction($data, $renderedText); |
|
117 | - } |
|
116 | + $renderedText = $this->applyAdditionalMarkupFunction($data, $renderedText); |
|
117 | + } |
|
118 | 118 | break; |
119 | 119 | case 'macro': |
120 | 120 | $renderedText = $this->renderMacro($data); |
@@ -241,17 +241,17 @@ discard block |
||
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
244 | - * @param $data |
|
245 | - * @param $renderedText |
|
244 | + * @param $data |
|
245 | + * @param $renderedText |
|
246 | 246 | * @return string |
247 | 247 | */ |
248 | 248 | private function formatRenderedText($data, $renderedText) |
249 | 249 | { |
250 | 250 | $text = $this->format($renderedText); |
251 | 251 | $res = $this->addAffixes($text); |
252 | - if (CiteProcHelper::isUsingAffixesByMarkupExtentsion($data, $this->toRenderTypeValue)) { |
|
253 | - $res = $this->applyAdditionalMarkupFunction($data, $res); |
|
254 | - } |
|
252 | + if (CiteProcHelper::isUsingAffixesByMarkupExtentsion($data, $this->toRenderTypeValue)) { |
|
253 | + $res = $this->applyAdditionalMarkupFunction($data, $res); |
|
254 | + } |
|
255 | 255 | if (!empty($res)) { |
256 | 256 | $res = $this->removeConsecutiveChars($res); |
257 | 257 | } |
@@ -267,9 +267,9 @@ discard block |
||
267 | 267 | private function renderCitationNumber($data, $citationNumber) |
268 | 268 | { |
269 | 269 | $renderedText = $citationNumber + 1; |
270 | - if (!CiteProcHelper::isUsingAffixesByMarkupExtentsion($data, $this->toRenderTypeValue)) { |
|
271 | - $renderedText = $this->applyAdditionalMarkupFunction($data, $renderedText); |
|
272 | - } |
|
270 | + if (!CiteProcHelper::isUsingAffixesByMarkupExtentsion($data, $this->toRenderTypeValue)) { |
|
271 | + $renderedText = $this->applyAdditionalMarkupFunction($data, $renderedText); |
|
272 | + } |
|
273 | 273 | return $renderedText; |
274 | 274 | } |
275 | 275 |
@@ -91,8 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | if (CiteProc::getContext()->isModeBibliography()) { |
94 | - foreach ($data as $citationNumber => $item) { |
|
95 | - ++self::$numberOfCitedItems; |
|
94 | + foreach ($data as $citationNumber => $item) {++self::$numberOfCitedItems; |
|
96 | 95 | CiteProc::getContext()->getResults()->append( |
97 | 96 | $this->wrapBibEntry($item, $this->renderSingle($item, $citationNumber)) |
98 | 97 | ); |
@@ -149,8 +148,8 @@ discard block |
||
149 | 148 | $this->htmlentities($this->format(implode("", $margin))). |
150 | 149 | $this->suffix |
151 | 150 | ); |
152 | - $res = '<div class="csl-left-margin">' . trim($leftMargin) . '</div>'; |
|
153 | - $res .= '<div class="csl-right-inline">' . trim($rightInline) . '</div>'; |
|
151 | + $res = '<div class="csl-left-margin">'.trim($leftMargin).'</div>'; |
|
152 | + $res .= '<div class="csl-right-inline">'.trim($rightInline).'</div>'; |
|
154 | 153 | return $res; |
155 | 154 | } elseif (!empty($inMargin)) { |
156 | 155 | $res = $this->format(implode("", $inMargin)); |
@@ -176,8 +175,8 @@ discard block |
||
176 | 175 | { |
177 | 176 | $value = $this->addAffixes($value); |
178 | 177 | return "\n ". |
179 | - "<div class=\"csl-entry\">" . |
|
180 | - $renderedItem = CiteProcHelper::applyAdditionMarkupFunction($dataItem, "csl-entry", $value) . |
|
178 | + "<div class=\"csl-entry\">". |
|
179 | + $renderedItem = CiteProcHelper::applyAdditionMarkupFunction($dataItem, "csl-entry", $value). |
|
181 | 180 | "</div>"; |
182 | 181 | } |
183 | 182 | |
@@ -218,7 +217,7 @@ discard block |
||
218 | 217 | { |
219 | 218 | $arr = $data->toArray(); |
220 | 219 | |
221 | - $arr_ = array_filter($arr, function ($dataItem) use ($citationItems) { |
|
220 | + $arr_ = array_filter($arr, function($dataItem) use ($citationItems) { |
|
222 | 221 | foreach ($citationItems as $citationItem) { |
223 | 222 | if ($dataItem->id === $citationItem->id) { |
224 | 223 | return true; |
@@ -19,5 +19,5 @@ |
||
19 | 19 | { |
20 | 20 | $firstChar = substr($string, 0, 1); |
21 | 21 | $firstCharUpper = strtr($firstChar, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'); |
22 | - return $firstCharUpper . substr($string, 1); |
|
22 | + return $firstCharUpper.substr($string, 1); |
|
23 | 23 | } |
@@ -32,10 +32,10 @@ |
||
32 | 32 | public static function createConstraint(string $name, string $value, string $match) |
33 | 33 | { |
34 | 34 | $parts = explode("-", $name); |
35 | - $className = implode("", array_map(function ($part) { |
|
36 | - return ucfirst($part);//overridden function |
|
35 | + $className = implode("", array_map(function($part) { |
|
36 | + return ucfirst($part); //overridden function |
|
37 | 37 | }, $parts)); |
38 | - $className = self::NAMESPACE_CONSTRAINTS . $className; |
|
38 | + $className = self::NAMESPACE_CONSTRAINTS.$className; |
|
39 | 39 | |
40 | 40 | if (!class_exists($className)) { |
41 | 41 | throw new ClassNotFoundException($className); |
@@ -85,12 +85,12 @@ |
||
85 | 85 | $lastChar = mb_substr($text, -1, 1); |
86 | 86 | if ($closeQuote === $lastChar) { // last char is closing quote? |
87 | 87 | $text = mb_substr($text, 0, mb_strlen($text) - 1); //set suffix before |
88 | - return $prefix . $text . $suffix . $lastChar; |
|
88 | + return $prefix.$text.$suffix.$lastChar; |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
93 | - return $prefix . $text . $suffix; |
|
93 | + return $prefix.$text.$suffix; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | foreach ($node->children() as $child) { |
97 | 97 | if ($child->getName() === "date-part") { |
98 | 98 | $datePartName = (string) $child->attributes()["name"]; |
99 | - $this->dateParts->set($this->form . "-" . $datePartName, Util\Factory::create($child)); |
|
99 | + $this->dateParts->set($this->form."-".$datePartName, Util\Factory::create($child)); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | if (!empty($dateFromLocale)) { |
275 | 275 | $dateForm = array_filter( |
276 | 276 | is_array($dateFromLocale) ? $dateFromLocale : [$dateFromLocale], |
277 | - function ($element) use ($format) { |
|
277 | + function($element) use ($format) { |
|
278 | 278 | /** @var SimpleXMLElement $element */ |
279 | 279 | $dateForm = (string) $element->attributes()["form"]; |
280 | 280 | return $dateForm === $format; |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | if ($this->dateParts->count() < 1 && in_array($form, self::$localizedDateFormats)) { |
337 | 337 | if ($this->hasDatePartsFromLocales($form)) { |
338 | 338 | $datePartsFromLocales = $this->getDatePartsFromLocales($form); |
339 | - array_filter($datePartsFromLocales, function (SimpleXMLElement $item) use ($dateParts) { |
|
339 | + array_filter($datePartsFromLocales, function(SimpleXMLElement $item) use ($dateParts) { |
|
340 | 340 | return in_array($item["name"], $dateParts); |
341 | 341 | }); |
342 | 342 | |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | */ |
405 | 405 | private function datePartsHaveAffixes() |
406 | 406 | { |
407 | - $result = $this->dateParts->filter(function (DatePart $datePart) { |
|
407 | + $result = $this->dateParts->filter(function(DatePart $datePart) { |
|
408 | 408 | return $datePart->renderSuffix() !== "" || $datePart->renderPrefix() !== ""; |
409 | 409 | }); |
410 | 410 | return $result->count() > 0; |
@@ -27,21 +27,21 @@ discard block |
||
27 | 27 | { |
28 | 28 | $markupExtension = CiteProc::getContext()->getMarkupExtension(); |
29 | 29 | if (array_key_exists($valueToRender, $markupExtension)) { |
30 | - if (is_array($markupExtension[$valueToRender]) && array_key_exists('function', $markupExtension[$valueToRender])) { |
|
31 | - $function = $markupExtension[$valueToRender]['function']; |
|
32 | - } else { |
|
33 | - $function = $markupExtension[$valueToRender]; |
|
34 | - } |
|
30 | + if (is_array($markupExtension[$valueToRender]) && array_key_exists('function', $markupExtension[$valueToRender])) { |
|
31 | + $function = $markupExtension[$valueToRender]['function']; |
|
32 | + } else { |
|
33 | + $function = $markupExtension[$valueToRender]; |
|
34 | + } |
|
35 | 35 | if (is_callable($function)) { |
36 | 36 | $renderedText = $function($dataItem, $renderedText); |
37 | 37 | } |
38 | 38 | } elseif (array_key_exists($mode = CiteProc::getContext()->getMode(), $markupExtension)) { |
39 | 39 | if (array_key_exists($valueToRender, $markupExtension[$mode])) { |
40 | - if (is_array($markupExtension[$mode][$valueToRender]) && array_key_exists('function', $markupExtension[$mode][$valueToRender])) { |
|
41 | - $function = CiteProc::getContext()->getMarkupExtension()[$mode][$valueToRender]['function']; |
|
42 | - } else { |
|
43 | - $function = CiteProc::getContext()->getMarkupExtension()[$mode][$valueToRender]; |
|
44 | - } |
|
40 | + if (is_array($markupExtension[$mode][$valueToRender]) && array_key_exists('function', $markupExtension[$mode][$valueToRender])) { |
|
41 | + $function = CiteProc::getContext()->getMarkupExtension()[$mode][$valueToRender]['function']; |
|
42 | + } else { |
|
43 | + $function = CiteProc::getContext()->getMarkupExtension()[$mode][$valueToRender]; |
|
44 | + } |
|
45 | 45 | if (is_callable($function)) { |
46 | 46 | $renderedText = $function($dataItem, $renderedText); |
47 | 47 | } |
@@ -63,26 +63,26 @@ discard block |
||
63 | 63 | return $newArray; |
64 | 64 | } |
65 | 65 | |
66 | - /** |
|
67 | - * @param stdClass $dataItem the actual item |
|
68 | - * @param string $valueToRender value the has to apply on |
|
69 | - * @return bool |
|
70 | - */ |
|
66 | + /** |
|
67 | + * @param stdClass $dataItem the actual item |
|
68 | + * @param string $valueToRender value the has to apply on |
|
69 | + * @return bool |
|
70 | + */ |
|
71 | 71 | public static function isUsingAffixesByMarkupExtentsion($dataItem, $valueToRender) |
72 | - { |
|
73 | - $markupExtension = CiteProc::getContext()->getMarkupExtension(); |
|
74 | - if (array_key_exists($valueToRender, $markupExtension)) { |
|
75 | - if (is_array($markupExtension[$valueToRender]) && array_key_exists('affixes', $markupExtension[$valueToRender])) { |
|
76 | - return $markupExtension[$valueToRender]['affixes']; |
|
77 | - } |
|
78 | - } elseif (array_key_exists($mode = CiteProc::getContext()->getMode(), $markupExtension)) { |
|
79 | - if (array_key_exists($valueToRender, $markupExtension[$mode])) { |
|
80 | - if (is_array($markupExtension[$mode][$valueToRender]) && array_key_exists('affixes', $markupExtension[$mode][$valueToRender])) { |
|
81 | - return CiteProc::getContext()->getMarkupExtension()[$mode][$valueToRender]['affixes']; |
|
82 | - } |
|
83 | - } |
|
84 | - } |
|
72 | + { |
|
73 | + $markupExtension = CiteProc::getContext()->getMarkupExtension(); |
|
74 | + if (array_key_exists($valueToRender, $markupExtension)) { |
|
75 | + if (is_array($markupExtension[$valueToRender]) && array_key_exists('affixes', $markupExtension[$valueToRender])) { |
|
76 | + return $markupExtension[$valueToRender]['affixes']; |
|
77 | + } |
|
78 | + } elseif (array_key_exists($mode = CiteProc::getContext()->getMode(), $markupExtension)) { |
|
79 | + if (array_key_exists($valueToRender, $markupExtension[$mode])) { |
|
80 | + if (is_array($markupExtension[$mode][$valueToRender]) && array_key_exists('affixes', $markupExtension[$mode][$valueToRender])) { |
|
81 | + return CiteProc::getContext()->getMarkupExtension()[$mode][$valueToRender]['affixes']; |
|
82 | + } |
|
83 | + } |
|
84 | + } |
|
85 | 85 | |
86 | - return FALSE; |
|
87 | - } |
|
86 | + return FALSE; |
|
87 | + } |
|
88 | 88 | } |
@@ -77,7 +77,7 @@ |
||
77 | 77 | { |
78 | 78 | $wordArray = explode(" ", $text); |
79 | 79 | |
80 | - array_walk($wordArray, function (&$word) { |
|
80 | + array_walk($wordArray, function(&$word) { |
|
81 | 81 | $word = ucfirst($word); |
82 | 82 | }); |
83 | 83 |
@@ -53,12 +53,12 @@ |
||
53 | 53 | if (preg_match("/^(.+)([\.,;]+)$/", $text, $match)) { |
54 | 54 | $punctuation = substr($match[2], -1); |
55 | 55 | if ($this->suffix !== $punctuation) { |
56 | - $text = $match[1] . substr($match[2], 0, strlen($match[2]) - 1); |
|
57 | - return $openQuote . $text . $closeQuote . $punctuation; |
|
56 | + $text = $match[1].substr($match[2], 0, strlen($match[2]) - 1); |
|
57 | + return $openQuote.$text.$closeQuote.$punctuation; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
61 | - return $openQuote . $text . $closeQuote; |
|
61 | + return $openQuote.$text.$closeQuote; |
|
62 | 62 | } |
63 | 63 | return $text; |
64 | 64 | } |