@@ -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; |
@@ -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 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public static function loadStyleSheet(string $styleName): string |
| 37 | 37 | { |
| 38 | - $stylesPath = self::vendorPath() . "/citation-style-language/styles"; |
|
| 38 | + $stylesPath = self::vendorPath()."/citation-style-language/styles"; |
|
| 39 | 39 | return self::readFileContentsOrThrowException("$stylesPath/$styleName.csl"); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public static function loadLocalesMetadata() |
| 83 | 83 | { |
| 84 | - $localesMetadataPath = self::vendorPath() . "/citation-style-language/locales/locales.json"; |
|
| 84 | + $localesMetadataPath = self::vendorPath()."/citation-style-language/locales/locales.json"; |
|
| 85 | 85 | return json_decode(self::readFileContentsOrThrowException($localesMetadataPath)); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | private static function vendorPath() |
| 93 | 93 | { |
| 94 | - include_once realpath(__DIR__ . '/../') . '/vendorPath.php'; |
|
| 94 | + include_once realpath(__DIR__.'/../').'/vendorPath.php'; |
|
| 95 | 95 | if (!($vendorPath = vendorPath())) { |
| 96 | 96 | throw new CiteProcException('vendor path not found. Use composer to initialize your project'); |
| 97 | 97 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $str .= $this->label->render($data); |
| 207 | 207 | } |
| 208 | 208 | $vars = $this->variables->toArray(); |
| 209 | - $vars = array_filter($vars, function ($value) { |
|
| 209 | + $vars = array_filter($vars, function($value) { |
|
| 210 | 210 | return !($value === "editor" || $value === "translator"); |
| 211 | 211 | }); |
| 212 | 212 | $this->variables->setArray($vars); |
@@ -268,13 +268,13 @@ discard block |
||
| 268 | 268 | trim($this->label->renderSuffix()), |
| 269 | 269 | Punctuation::getAllPunctuations() |
| 270 | 270 | ) ? " " : ""; |
| 271 | - $result = $renderedLabel . $delimiter . trim($name); |
|
| 271 | + $result = $renderedLabel.$delimiter.trim($name); |
|
| 272 | 272 | } else { |
| 273 | 273 | $delimiter = !in_array( |
| 274 | 274 | trim($this->label->renderPrefix()), |
| 275 | 275 | Punctuation::getAllPunctuations() |
| 276 | 276 | ) ? " " : ""; |
| 277 | - $result = trim($name) . $delimiter . $renderedLabel; |
|
| 277 | + $result = trim($name).$delimiter.$renderedLabel; |
|
| 278 | 278 | } |
| 279 | 279 | return $result; |
| 280 | 280 | } |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | private function filterEmpty(array $results) |
| 401 | 401 | { |
| 402 | - return array_filter($results, function ($item) { |
|
| 402 | + return array_filter($results, function($item) { |
|
| 403 | 403 | return !empty($item); |
| 404 | 404 | }); |
| 405 | 405 | } |
@@ -22,10 +22,10 @@ |
||
| 22 | 22 | $values = new ArrayList(); |
| 23 | 23 | return $values |
| 24 | 24 | ->setArray(Punctuation::toArray()) |
| 25 | - ->map(function (string $punctuation) { |
|
| 25 | + ->map(function(string $punctuation) { |
|
| 26 | 26 | return CiteProc::getContext()->getLocale()->filter("terms", $punctuation)->single; |
| 27 | 27 | }) |
| 28 | - ->collect(function ($items) { |
|
| 28 | + ->collect(function($items) { |
|
| 29 | 29 | return array_values($items); |
| 30 | 30 | }); |
| 31 | 31 | } |