MediaWiki master
Formal.php
Go to the documentation of this file.
1<?php
8
10
27class Formal {
28
36 public function __construct(
37 private readonly Provider $provider,
38 ) {
39 }
40
53 public function process( array $options ): string {
54 $informal = $options[0];
55 $formal = $options[1] ?? $informal;
56
57 $index = $this->provider->getFormalityIndexProvider()->getFormalityIndex();
58
59 return ( $index === 1 ) ? $formal : $informal;
60 }
61}
process(array $options)
Selects the appropriate text form based on formality.
Definition Formal.php:53
__construct(private readonly Provider $provider,)
Initializes the Formal handler with the provider.
Definition Formal.php:36