@@ -49,6 +49,9 @@ |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
| 52 | + /** |
|
| 53 | + * @param string $lang |
|
| 54 | + */ |
|
| 52 | 55 | public static function loadLocale($lang) { |
| 53 | 56 | $directory = __DIR__."/../../../../vendor/academicpuma/locales"; |
| 54 | 57 | $file = $directory . "/locales-" . ($lang) . ".xml"; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $wordArray = explode(" ", $text); |
| 65 | 65 | |
| 66 | - array_walk($wordArray, function (&$word) { |
|
| 66 | + array_walk($wordArray, function(&$word) { |
|
| 67 | 67 | $word = ucfirst($word); |
| 68 | 68 | }); |
| 69 | 69 | |
@@ -73,16 +73,16 @@ discard block |
||
| 73 | 73 | public static function capitalizeForTitle($titleString) |
| 74 | 74 | { |
| 75 | 75 | if (preg_match('/(.+[^\<\>][\.:\/;\?\!]\s?)([a-z])(.+)/', $titleString, $match)) { |
| 76 | - $titleString = $match[1].StringHelper::mb_ucfirst($match[2]).$match[3]; |
|
| 76 | + $titleString = $match[1] . StringHelper::mb_ucfirst($match[2]) . $match[3]; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $wordArray = explode(" ", $titleString); |
| 80 | 80 | |
| 81 | - array_walk($wordArray, function (&$word) { |
|
| 81 | + array_walk($wordArray, function(&$word) { |
|
| 82 | 82 | |
| 83 | 83 | $words = explode("-", $word); |
| 84 | 84 | if (count($words) > 1) { |
| 85 | - array_walk($words, function (&$w) { |
|
| 85 | + array_walk($words, function(&$w) { |
|
| 86 | 86 | $w = StringHelper::keepLowerCase($w) ? $w : StringHelper::mb_ucfirst($w); |
| 87 | 87 | }); |
| 88 | 88 | $word = implode("-", $words); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | public static function keepLowerCase($word) |
| 97 | 97 | { |
| 98 | - $lowerCase = in_array($word, self::PREPOSITIONS) || |
|
| 98 | + $lowerCase = in_array($word, self::PREPOSITIONS) || |
|
| 99 | 99 | in_array($word, self::ARTICLES) || |
| 100 | 100 | in_array($word, self::CONJUNCTIONS) || |
| 101 | 101 | in_array($word, self::ADJECTIVES); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $then = mb_substr($string, 1, $strlen - 1, $encoding); |
| 111 | 111 | $encodings = ['ISO-8859-7']; |
| 112 | 112 | $encoding = mb_detect_encoding($firstChar, $encodings, true); |
| 113 | - return in_array($encoding, $encodings) ? $firstChar.$then : mb_strtoupper($firstChar, $encoding) . $then; |
|
| 113 | + return in_array($encoding, $encodings) ? $firstChar . $then : mb_strtoupper($firstChar, $encoding) . $then; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | public static function explodeBySpaceOrHyphen($string) |
@@ -58,8 +58,7 @@ |
||
| 58 | 58 | foreach ($this->formattingOptions as $option => $optionValue) { |
| 59 | 59 | if ($optionValue === "italic") { |
| 60 | 60 | $text = "<i>$text</i>"; |
| 61 | - } |
|
| 62 | - else if ($optionValue === "bold") { |
|
| 61 | + } else if ($optionValue === "bold") { |
|
| 63 | 62 | $text = "<b>$text</b>"; |
| 64 | 63 | } else { |
| 65 | 64 | $format .= "$option:$optionValue;"; |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | foreach ($node->attributes() as $attribute) { |
| 219 | 219 | switch ($attribute->getName()) { |
| 220 | 220 | case 'and': |
| 221 | - $and = (string)$attribute; |
|
| 221 | + $and = (string) $attribute; |
|
| 222 | 222 | if ("text" === $and) { |
| 223 | 223 | $this->and = CiteProc::getContext()->getLocale()->filter('terms', 'and')->single; |
| 224 | 224 | } elseif ('symbol' === $and) { |
@@ -327,16 +327,16 @@ discard block |
||
| 327 | 327 | if (count($resultNames) === 1) { |
| 328 | 328 | $text .= " $etAl"; |
| 329 | 329 | } else { |
| 330 | - $text .= $this->delimiter . $etAl; |
|
| 330 | + $text .= $this->delimiter . $etAl; |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | if ($this->form == 'count') { |
| 336 | 336 | if ($etAl === false) { |
| 337 | - return (int)count($resultNames); |
|
| 337 | + return (int) count($resultNames); |
|
| 338 | 338 | } else { |
| 339 | - return (int)(count($resultNames) - 1); |
|
| 339 | + return (int) (count($resultNames) - 1); |
|
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | 342 | // strip out the last delimiter if not required |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | if (count($this->nameParts) > 0) { |
| 377 | 377 | /** @var NamePart $namePart */ |
| 378 | 378 | foreach ($this->nameParts as $namePart) { |
| 379 | - $name->{$namePart->getName()} = $namePart->render($name); |
|
| 379 | + $name->{$namePart->getName()} = $namePart->render($name); |
|
| 380 | 380 | } |
| 381 | 381 | $name->suffix = ''; |
| 382 | 382 | $name->{'non-dropping-particle'} = ''; |