@@ -37,7 +37,7 @@ |
||
| 37 | 37 | return $text; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - switch ((string)$this->textCase) { |
|
| 40 | + switch ((string) $this->textCase) { |
|
| 41 | 41 | case TextCase::UPPERCASE: |
| 42 | 42 | $text = $this->keepNoCase(mb_strtoupper($text), $text); |
| 43 | 43 | break; |
@@ -29,6 +29,6 @@ |
||
| 29 | 29 | return $text; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - return sprintf("<div class=\"csl-%s\">%s</div>", (string)$this->display, $text); |
|
| 32 | + return sprintf("<div class=\"csl-%s\">%s</div>", (string) $this->display, $text); |
|
| 33 | 33 | } |
| 34 | 34 | } |
@@ -35,19 +35,19 @@ |
||
| 35 | 35 | $name = $attribute->getName(); |
| 36 | 36 | switch ($name) { |
| 37 | 37 | case 'prefix': |
| 38 | - $prefix = (string)$attribute; |
|
| 38 | + $prefix = (string) $attribute; |
|
| 39 | 39 | break; |
| 40 | 40 | case 'suffix': |
| 41 | - $suffix = (string)$attribute; |
|
| 41 | + $suffix = (string) $attribute; |
|
| 42 | 42 | break; |
| 43 | 43 | case 'text-case': |
| 44 | - $textCase = new TextCase((string)$attribute); |
|
| 44 | + $textCase = new TextCase((string) $attribute); |
|
| 45 | 45 | break; |
| 46 | 46 | case 'display': |
| 47 | - $display = new Display((string)$attribute); |
|
| 47 | + $display = new Display((string) $attribute); |
|
| 48 | 48 | break; |
| 49 | 49 | case 'quotes': |
| 50 | - $quotes = "true" === (string)$attribute; |
|
| 50 | + $quotes = "true" === (string) $attribute; |
|
| 51 | 51 | break; |
| 52 | 52 | default: |
| 53 | 53 | if (in_array($attribute->getName(), $formattingAttributes)) { |
@@ -75,14 +75,14 @@ discard block |
||
| 75 | 75 | { |
| 76 | 76 | $data = null; |
| 77 | 77 | $localesPath = vendorPath() . "/citation-style-language/locales/"; |
| 78 | - $localeFile = $localesPath."locales-".$langKey.'.xml'; |
|
| 78 | + $localeFile = $localesPath . "locales-" . $langKey . '.xml'; |
|
| 79 | 79 | if (file_exists($localeFile)) { |
| 80 | 80 | $data = file_get_contents($localeFile); |
| 81 | 81 | } else { |
| 82 | 82 | $metadata = loadLocalesMetadata(); |
| 83 | 83 | if (!empty($metadata->{'primary-dialects'}->{$langKey})) { |
| 84 | 84 | $data = file_get_contents( |
| 85 | - $localesPath."locales-".$metadata->{'primary-dialects'}->{$langKey}.'.xml' |
|
| 85 | + $localesPath . "locales-" . $metadata->{'primary-dialects'}->{$langKey} . '.xml' |
|
| 86 | 86 | ); |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | function getCurrentById(ArrayListInterface $list, $id) |
| 108 | 108 | { |
| 109 | - return $list->filter(function ($item) use ($id) { |
|
| 109 | + return $list->filter(function($item) use ($id) { |
|
| 110 | 110 | return $item->id === $id; |
| 111 | 111 | })->current(); |
| 112 | 112 | } |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | if (!in_array($this->display, self::$allowedValues)) { |
| 58 | 58 | return $text; |
| 59 | 59 | } |
| 60 | - $divStyle = "class=\"csl-".$this->display."\""; |
|
| 60 | + $divStyle = "class=\"csl-" . $this->display . "\""; |
|
| 61 | 61 | return "<div $divStyle>$text</div>"; |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | if (empty($punctuationSign) || preg_match("/^\s+$/", $punctuationSign)) { |
| 43 | 43 | return $subject; |
| 44 | 44 | } |
| 45 | - $pattern = '/'.preg_quote(trim($punctuationSign), '/').'{2,}/'; |
|
| 45 | + $pattern = '/' . preg_quote(trim($punctuationSign), '/') . '{2,}/'; |
|
| 46 | 46 | if (preg_match($pattern, $subject)) { |
| 47 | 47 | return preg_replace($pattern, $punctuationSign, $subject); |
| 48 | 48 | } |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | */ |
| 65 | 65 | public function __toString() |
| 66 | 66 | { |
| 67 | - $directives = "\t".implode("\n\t", $this->directives->toArray()); |
|
| 68 | - return $this->selectorType.$this->selector." {\n".$directives."\n}\n"; |
|
| 67 | + $directives = "\t" . implode("\n\t", $this->directives->toArray()); |
|
| 68 | + return $this->selectorType . $this->selector . " {\n" . $directives . "\n}\n"; |
|
| 69 | 69 | } |
| 70 | 70 | } |
@@ -32,8 +32,8 @@ |
||
| 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 | 38 | $className = self::NAMESPACE_CONSTRAINTS . $className; |
| 39 | 39 | |
@@ -93,20 +93,20 @@ discard block |
||
| 93 | 93 | $textParts = []; |
| 94 | 94 | $terms = $variables = $haveVariables = $elementCount = 0; |
| 95 | 95 | foreach ($this->children as $child) { |
| 96 | - $elementCount++; |
|
| 96 | + $elementCount ++; |
|
| 97 | 97 | |
| 98 | 98 | if (($child instanceof Text) && in_array($child->getSource(), ['term', 'value'])) { |
| 99 | - ++$terms; |
|
| 99 | + ++ $terms; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | if (($child instanceof Label)) { |
| 103 | - ++$terms; |
|
| 103 | + ++ $terms; |
|
| 104 | 104 | } |
| 105 | 105 | if (method_exists($child, "getSource") && $child->getSource() == 'variable' |
| 106 | 106 | && !empty($child->getVariable()) && $child->getVariable() != "date" |
| 107 | 107 | && !empty($data->{$child->getVariable()}) |
| 108 | 108 | ) { |
| 109 | - ++$variables; |
|
| 109 | + ++ $variables; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | $text = $child->render($data, $citationNumber); |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | "getVariable" |
| 131 | 131 | ) && $child->getVariable() != "date" && !empty($child->getVariable())) |
| 132 | 132 | ) { |
| 133 | - $haveVariables++; |
|
| 133 | + $haveVariables ++; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (method_exists($child, "getSource") && $child->getSource() == 'macro') { |
| 137 | - $haveVariables++; |
|
| 137 | + $haveVariables ++; |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | } |