@@ -46,6 +46,9 @@ |
||
46 | 46 | return $this->language; |
47 | 47 | } |
48 | 48 | |
49 | + /** |
|
50 | + * @param string $type |
|
51 | + */ |
|
49 | 52 | public function filter($type, $name, $form = "long") { |
50 | 53 | |
51 | 54 | if (!isset($this->{$type})) { |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Seboettg\CiteProc\Locale; |
3 | 3 | use Seboettg\CiteProc\Util\Factory; |
4 | -use Seboettg\Collection\ArrayList; |
|
5 | 4 | |
6 | 5 | /** |
7 | 6 | */ |
@@ -130,7 +130,7 @@ |
||
130 | 130 | * addition, the “editortranslator” term is used if the Names element contains a Label element, replacing the |
131 | 131 | * default “editor” and “translator” terms (e.g. resulting in “Doe (editor & translator)”). |
132 | 132 | * |
133 | - * @param $data |
|
133 | + * @param \stdClass $data |
|
134 | 134 | * @return string |
135 | 135 | */ |
136 | 136 | public function render($data) |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | /** @var \SimpleXMLElement $attribute */ |
112 | 112 | foreach ($node->attributes() as $attribute) { |
113 | 113 | if ("variable" === $attribute->getName()) { |
114 | - $this->variables = new ArrayList(explode(" ", (string)$attribute)); |
|
114 | + $this->variables = new ArrayList(explode(" ", (string) $attribute)); |
|
115 | 115 | break; |
116 | 116 | } |
117 | 117 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | } |
187 | 187 | } |
188 | 188 | } |
189 | - $str .= implode($this->delimiter, $results); |
|
189 | + $str .= implode($this->delimiter, $results); |
|
190 | 190 | return $this->addAffixes($str); |
191 | 191 | } |
192 | 192 |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Seboettg\CiteProc\Styles\AffixesTrait; |
6 | 6 | use Seboettg\CiteProc\Styles\DisplayTrait; |
7 | 7 | use Seboettg\CiteProc\Styles\FormattingTrait; |
8 | -use Seboettg\CiteProc\Styles\QuotesTrait; |
|
9 | 8 | use Seboettg\CiteProc\Styles\TextCaseTrait; |
10 | 9 | |
11 | 10 |
@@ -35,6 +35,9 @@ discard block |
||
35 | 35 | "et-al" => "\\Name\\EtAl" |
36 | 36 | ]; |
37 | 37 | |
38 | + /** |
|
39 | + * @param \Seboettg\CiteProc\Rendering\Name\Names $param |
|
40 | + */ |
|
38 | 41 | public static function create($node, $param = null) |
39 | 42 | { |
40 | 43 | $nodeClass = self::CITE_PROC_NODE_NAMESPACE . self::$nodes[$node->getName()]; |
@@ -48,6 +51,9 @@ discard block |
||
48 | 51 | } |
49 | 52 | |
50 | 53 | |
54 | + /** |
|
55 | + * @param string $lang |
|
56 | + */ |
|
51 | 57 | public static function loadLocale($lang) { |
52 | 58 | $directory = __DIR__."/../../../../vendor/academicpuma/locales"; |
53 | 59 | $file = $directory . "/locales-" . ($lang) . ".xml"; |
@@ -49,7 +49,7 @@ |
||
49 | 49 | |
50 | 50 | |
51 | 51 | public static function loadLocale($lang) { |
52 | - $directory = __DIR__."/../../../../vendor/academicpuma/locales"; |
|
52 | + $directory = __DIR__ . "/../../../../vendor/academicpuma/locales"; |
|
53 | 53 | $file = $directory . "/locales-" . ($lang) . ".xml"; |
54 | 54 | |
55 | 55 | if (file_exists($file) == false) { |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | foreach ($node->attributes() as $attribute) { |
37 | 37 | |
38 | 38 | /** @var string $name */ |
39 | - $name = (string)$attribute->getName(); |
|
40 | - $value = (string)$attribute; |
|
39 | + $name = (string) $attribute->getName(); |
|
40 | + $value = (string) $attribute; |
|
41 | 41 | |
42 | 42 | if (in_array($name, self::$formattingAttributes)) { |
43 | 43 | $this->formattingOptions->add($name, $value); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | } |
65 | 65 | if (!empty($format)) { |
66 | - $text = '<span style="' . $format . '">'.$text.'</span>'; |
|
66 | + $text = '<span style="' . $format . '">' . $text . '</span>'; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | return $text; |
@@ -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': |
@@ -27,10 +27,10 @@ |
||
27 | 27 | { |
28 | 28 | $className = ""; |
29 | 29 | $parts = explode("-", $name); |
30 | - array_walk($parts, function ($part) use (&$className) { |
|
30 | + array_walk($parts, function($part) use (&$className) { |
|
31 | 31 | $className .= ucfirst($part); |
32 | 32 | }); |
33 | - $className = self::NAMESPACE_CONSTRAINTS.$className; |
|
33 | + $className = self::NAMESPACE_CONSTRAINTS . $className; |
|
34 | 34 | |
35 | 35 | if (!class_exists($className)) { |
36 | 36 | throw new ClassNotFoundException($className); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | foreach ($node->attributes() as $attribute) { |
192 | 192 | switch ($attribute->getName()) { |
193 | 193 | case 'and': |
194 | - $and = (string)$attribute; |
|
194 | + $and = (string) $attribute; |
|
195 | 195 | if ("text" === $and) { |
196 | 196 | $this->and = CiteProc::getContext()->getLocale()->filter('terms', 'and')->single; |
197 | 197 | } elseif ('symbol' === $and) { |
@@ -199,40 +199,40 @@ discard block |
||
199 | 199 | } |
200 | 200 | break; |
201 | 201 | case 'delimiter-precedes-et-al': |
202 | - $this->delimiterPrecedesEtAl = (string)$attribute; |
|
202 | + $this->delimiterPrecedesEtAl = (string) $attribute; |
|
203 | 203 | break; |
204 | 204 | case 'delimiter-precedes-last': |
205 | - $this->delimiterPrecedesLast = (string)$attribute; |
|
205 | + $this->delimiterPrecedesLast = (string) $attribute; |
|
206 | 206 | break; |
207 | 207 | case 'et-al-min': |
208 | - $this->etAlMin = intval((string)$attribute); |
|
208 | + $this->etAlMin = intval((string) $attribute); |
|
209 | 209 | break; |
210 | 210 | case 'et-al-use-first': |
211 | - $this->etAlUseFirst = intval((string)$attribute); |
|
211 | + $this->etAlUseFirst = intval((string) $attribute); |
|
212 | 212 | break; |
213 | 213 | case 'et-al-subsequent-min': |
214 | - $this->etAlSubsequentMin = intval((string)$attribute); |
|
214 | + $this->etAlSubsequentMin = intval((string) $attribute); |
|
215 | 215 | break; |
216 | 216 | case 'et-al-subsequent-use-first': |
217 | - $this->etAlSubsequentUseFirst = intval((string)$attribute); |
|
217 | + $this->etAlSubsequentUseFirst = intval((string) $attribute); |
|
218 | 218 | break; |
219 | 219 | case 'et-al-use-last': |
220 | - $this->etAlUseLast = boolval((string)$attribute); |
|
220 | + $this->etAlUseLast = boolval((string) $attribute); |
|
221 | 221 | break; |
222 | 222 | case 'form': |
223 | - $this->form = (string)$attribute; |
|
223 | + $this->form = (string) $attribute; |
|
224 | 224 | break; |
225 | 225 | case 'initialize': |
226 | - $this->initialize = boolval((string)$attribute); |
|
226 | + $this->initialize = boolval((string) $attribute); |
|
227 | 227 | break; |
228 | 228 | case 'initialize-with': |
229 | - $this->initializeWith = (string)$attribute; |
|
229 | + $this->initializeWith = (string) $attribute; |
|
230 | 230 | break; |
231 | 231 | case 'name-as-sort-order': |
232 | - $this->nameAsSortOrder = (string)$attribute; |
|
232 | + $this->nameAsSortOrder = (string) $attribute; |
|
233 | 233 | break; |
234 | 234 | case 'sort-separator': |
235 | - $this->sortSeparator = (string)$attribute; |
|
235 | + $this->sortSeparator = (string) $attribute; |
|
236 | 236 | |
237 | 237 | } |
238 | 238 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | (!empty($nonDroppingParticle) ? $nonDroppingParticle . " " : "") . |
290 | 290 | (trim($name->family) . $this->sortSeparator . trim($name->given)) . |
291 | 291 | (!empty($droppingParticle) ? " " . $droppingParticle : "") . |
292 | - (!empty($suffix) ? $this->sortSeparator . $suffix : ""); |
|
292 | + (!empty($suffix) ? $this->sortSeparator . $suffix : ""); |
|
293 | 293 | break; |
294 | 294 | /* |
295 | 295 | use form "given name [dropping particles] [non-dropping particles] family name [suffix]" |
@@ -297,10 +297,10 @@ discard block |
||
297 | 297 | */ |
298 | 298 | default: |
299 | 299 | $text = trim($name->given) . |
300 | - (!empty($droppingParticle) ? " " . trim($droppingParticle) : "") . |
|
300 | + (!empty($droppingParticle) ? " " . trim($droppingParticle) : "") . |
|
301 | 301 | (!empty($nonDroppingParticle) ? " " . trim($nonDroppingParticle) : "") . |
302 | 302 | (" " . $name->family) . |
303 | - (!empty($suffix) ? " " . trim($suffix) : ""); |
|
303 | + (!empty($suffix) ? " " . trim($suffix) : ""); |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 | $authors[] = trim($this->format($text)); |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | count($names) > $this->etAlUseFirst |
317 | 317 | ) { |
318 | 318 | if ($this->etAlUseFirst < $this->etAlMin) { |
319 | - for ($i = $this->etAlUseFirst; $i < $count-1; $i++) { |
|
319 | + for ($i = $this->etAlUseFirst; $i < $count - 1; $i++) { |
|
320 | 320 | unset($authors[$i]); |
321 | 321 | } |
322 | 322 | } |
@@ -350,9 +350,9 @@ discard block |
||
350 | 350 | } |
351 | 351 | if ($this->form == 'count') { |
352 | 352 | if (!$etAlTriggered) { |
353 | - return (int)count($authors); |
|
353 | + return (int) count($authors); |
|
354 | 354 | } else { |
355 | - return (int)(count($authors) - 1); |
|
355 | + return (int) (count($authors) - 1); |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 | // strip out the last delimiter if not required |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | foreach ($node->children() as $child) { |
64 | 64 | if ($child->getName() === "date-part") { |
65 | 65 | $datePartName = (string) $child->attributes()["name"]; |
66 | - $this->dateParts->set($this->form."-".$datePartName, Util\Factory::create($child)); |
|
66 | + $this->dateParts->set($this->form . "-" . $datePartName, Util\Factory::create($child)); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | { |
82 | 82 | $ret = ""; |
83 | 83 | $var = null; |
84 | - if(isset($data->{$this->variable})) { |
|
84 | + if (isset($data->{$this->variable})) { |
|
85 | 85 | $var = $data->{$this->variable}; |
86 | 86 | } else { |
87 | 87 | return ""; |