69 $endTime = $this->
microtime() + self::MAX_EXECUTE_SECONDS;
72 $includeCode = isset( $props[
'code'] );
73 $includeBcp47 = isset( $props[
'bcp47'] );
74 $includeDir = isset( $props[
'dir'] );
75 $includeAutonym = isset( $props[
'autonym'] );
76 $includeName = isset( $props[
'name'] );
77 $includeFallbacks = isset( $props[
'fallbacks'] );
78 $includeVariants = isset( $props[
'variants'] );
80 $targetLanguageCode = $this->
getLanguage()->getCode();
83 $availableLanguageCodes = array_keys( Language::fetchLanguageNames(
92 if ( $selectedLanguageCodes === [
'*' ] ) {
93 $languageCodes = $availableLanguageCodes;
95 $languageCodes = array_values( array_intersect(
96 $availableLanguageCodes,
97 $selectedLanguageCodes
99 $unrecognizedCodes = array_values( array_diff(
100 $selectedLanguageCodes,
101 $availableLanguageCodes
103 if ( $unrecognizedCodes !== [] ) {
105 'apiwarn-unrecognizedvalues',
108 count( $unrecognizedCodes ),
116 if ( $continue ===
null ) {
117 $continue = reset( $languageCodes );
125 $result->addArrayType( $rootPath,
'assoc' );
127 foreach ( $languageCodes as $languageCode ) {
128 if ( $languageCode < $continue ) {
133 if ( $now >= $endTime ) {
141 if ( $includeCode ) {
142 $info[
'code'] = $languageCode;
145 if ( $includeBcp47 ) {
146 $bcp47 = LanguageCode::bcp47( $languageCode );
147 $info[
'bcp47'] = $bcp47;
151 $dir = Language::factory( $languageCode )->getDir();
155 if ( $includeAutonym ) {
156 $autonym = Language::fetchLanguageName(
158 Language::AS_AUTONYMS,
161 $info[
'autonym'] = $autonym;
164 if ( $includeName ) {
165 $name = Language::fetchLanguageName(
170 $info[
'name'] = $name;
173 if ( $includeFallbacks ) {
174 $fallbacks = Language::getFallbacksFor(
177 Language::STRICT_FALLBACKS
180 $info[
'fallbacks'] = $fallbacks;
183 if ( $includeVariants ) {
184 $variants = Language::factory( $languageCode )->getVariants();
186 $info[
'variants'] = $variants;
189 $fit = $result->addValue( $rootPath, $languageCode, $info );