@@ -44,7 +44,7 @@ |
||
| 44 | 44 | * formatting attributes. |
| 45 | 45 | */ |
| 46 | 46 | case 'layout': |
| 47 | - $this->layout = new Layout($child); |
|
| 47 | + $this->layout = new Layout($child); |
|
| 48 | 48 | break; |
| 49 | 49 | |
| 50 | 50 | /* cs:citation and cs:bibliography may include a cs:sort child element before the cs:layout element to |
@@ -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})) { |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | private function parseXml(\SimpleXMLElement $locale) |
| 53 | 53 | { |
| 54 | 54 | foreach ($locale as $node) { |
| 55 | - switch($node->getName()) { |
|
| 55 | + switch ($node->getName()) { |
|
| 56 | 56 | case 'style-options': |
| 57 | 57 | $this->optionsXml->add('options', $node); |
| 58 | 58 | foreach ($node->attributes() as $name => $value) { |
@@ -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 | } |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | else if (preg_match(Number::PATTERN_ROMAN, $evalValue)) { |
| 57 | 57 | return Number::roman2Dec($evalValue) !== false; |
| 58 | 58 | } |
| 59 | - else if (preg_match(Number::PATTERN_COMMA_AMPERSAND_RANGE, $evalValue)){ |
|
| 59 | + else if (preg_match(Number::PATTERN_COMMA_AMPERSAND_RANGE, $evalValue)) { |
|
| 60 | 60 | return true; |
| 61 | 61 | } |
| 62 | 62 | return false; |
@@ -48,15 +48,12 @@ |
||
| 48 | 48 | { |
| 49 | 49 | if (is_numeric($evalValue)) { |
| 50 | 50 | return true; |
| 51 | - } |
|
| 52 | - else if (preg_match(Number::PATTERN_ORDINAL, $evalValue)) { |
|
| 51 | + } else if (preg_match(Number::PATTERN_ORDINAL, $evalValue)) { |
|
| 53 | 52 | $numberFormatter = new NumberFormatter(CiteProc::getContext()->getLocale()->getLanguage(), NumberFormatter::ORDINAL); |
| 54 | 53 | return $numberFormatter->parse($evalValue) !== false; |
| 55 | - } |
|
| 56 | - else if (preg_match(Number::PATTERN_ROMAN, $evalValue)) { |
|
| 54 | + } else if (preg_match(Number::PATTERN_ROMAN, $evalValue)) { |
|
| 57 | 55 | return Number::roman2Dec($evalValue) !== false; |
| 58 | - } |
|
| 59 | - else if (preg_match(Number::PATTERN_COMMA_AMPERSAND_RANGE, $evalValue)){ |
|
| 56 | + } else if (preg_match(Number::PATTERN_COMMA_AMPERSAND_RANGE, $evalValue)){ |
|
| 60 | 57 | return true; |
| 61 | 58 | } |
| 62 | 59 | return false; |
@@ -18,8 +18,8 @@ |
||
| 18 | 18 | /** @var \SimpleXMLElement $attribute */ |
| 19 | 19 | foreach ($node->attributes() as $attribute) { |
| 20 | 20 | /** @var string $name */ |
| 21 | - $name = (string)$attribute->getName(); |
|
| 22 | - $value = (string)$attribute; |
|
| 21 | + $name = (string) $attribute->getName(); |
|
| 22 | + $value = (string) $attribute; |
|
| 23 | 23 | |
| 24 | 24 | switch ($name) { |
| 25 | 25 | case 'prefix': |
@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | if (CiteProc::getContext()->isModeBibliography()) { |
| 55 | 55 | if (is_array($data)) { |
| 56 | 56 | $arr = []; |
| 57 | - foreach ($data as $item) { |
|
| 58 | - ++self::$numberOfCitedItems; |
|
| 57 | + foreach ($data as $item) {++self::$numberOfCitedItems; |
|
| 59 | 58 | $arr[] = $this->wrapBibEntry($this->renderSingle($item)); |
| 60 | 59 | } |
| 61 | 60 | $ret .= implode($this->delimiter, $arr); |
@@ -63,7 +62,7 @@ discard block |
||
| 63 | 62 | $ret .= $this->wrapBibEntry($this->renderSingle($data)); |
| 64 | 63 | } |
| 65 | 64 | |
| 66 | - return "<div class=\"csl-bib-body\">".$ret."\n</div>"; |
|
| 65 | + return "<div class=\"csl-bib-body\">" . $ret . "\n</div>"; |
|
| 67 | 66 | |
| 68 | 67 | } else if (CiteProc::getContext()->isModeCitation()) { |
| 69 | 68 | if (is_array($data)) { |
@@ -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) |
@@ -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'} = ''; |