Completed
Push — master ( 02fcb9...4774b2 )
by Chin
01:05
created

PhpWeekday::inPunjabi()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace ChinLeung\PhpWeekday;
4
5
use InvalidArgumentException;
6
7
class PhpWeekday
8
{
9
    /**
10
     * The locale of the application.
11
     *
12
     * @var string
13
     */
14
    protected $locale;
15
16
    /**
17
     * The name of the weekday.
18
     *
19
     * @var string
20
     */
21
    protected $name;
22
23
    /**
24
     * The value of the weekday.
25
     *
26
     * @var int
27
     */
28
    protected $value;
29
30
    /**
31
     * Constructor of the class.
32
     *
33
     * @param  string|int  $value
34
     * @param  string  $locale
35
     * @return self
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
36
     */
37
    public function __construct($value, string $locale)
38
    {
39
        $this->setLocale($locale)
40
             ->set($value);
41
42
        return $this;
0 ignored issues
show
Bug introduced by
Constructors do not have meaningful return values, anything that is returned from here is discarded. Are you sure this is correct?
Loading history...
43
    }
44
45
    /**
46
     * Retrieve the current locale.
47
     *
48
     * @return string
49
     */
50
    public function getLocale() : string
51
    {
52
        return $this->locale;
53
    }
54
55
    /**
56
     * Retrieve the supported locales.
57
     *
58
     * @return array
59
     */
60
    public static function getLocales() : array
61
    {
62
        return array_map(
63
            'basename',
64
            glob(__DIR__.'/../resources/lang/*') ?: []
65
        );
66
    }
67
68
    /**
69
     * Retrieve the name of the weekday.
70
     *
71
     * @param  string  $locale
72
     * @return string
73
     */
74
    public function getName(string $locale = null) : string
75
    {
76
        if ($locale && $locale != $this->locale) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $locale of type null|string is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
77
            return $this->parseName($this->getValue(), $locale);
78
        }
79
80
        if (is_null($this->name)) {
81
            $this->name = $this->parseName($this->getValue());
82
        }
83
84
        return $this->name;
85
    }
86
87
    /**
88
     * Retrieve the name from a value.
89
     *
90
     * @param  int  $value
91
     * @param  string  $locale
92
     * @return string
93
     */
94
    public static function getNameFromValue(int $value, string $locale) : string
95
    {
96
        return static::parse($value, $locale)->getName();
97
    }
98
99
    /**
100
     * Retrieve the names of every weekday for a locale.
101
     *
102
     * @param  string  $locale
103
     * @return array
104
     */
105
    public static function getNames(string $locale) : array
106
    {
107
        $path = __DIR__."/../resources/lang/$locale/names.php";
108
109
        if (! file_exists($path)) {
110
            static::throwNotSupportedLocaleException($locale);
111
        }
112
113
        return require $path;
114
    }
115
116
    /**
117
     * Retrieve the value of the weekday.
118
     *
119
     * @return int
120
     */
121
    public function getValue() : int
122
    {
123
        if (is_null($this->value)) {
124
            $this->value = $this->parseValue($this->getName());
125
        }
126
127
        return $this->value;
128
    }
129
130
    /**
131
     * Retrieve the value from a name.
132
     *
133
     * @param  string  $name
134
     * @param  string  $locale
135
     * @return string
136
     */
137
    public static function getValueFromName(string $name, string $locale) : string
138
    {
139
        return static::parse($name, $locale)->getValue();
140
    }
141
142
    /**
143
     * Check if the locale is supported.
144
     *
145
     * @param  string  $locale
146
     * @return bool
147
     */
148
    public function isSupported(string $locale) : bool
149
    {
150
        return file_exists(__DIR__."/../resources/lang/$locale");
151
    }
152
153
    /**
154
     * Check if the locale is not supported.
155
     *
156
     * @param  string  $locale
157
     * @return bool
158
     */
159
    public function isNotSupported(string $locale) : bool
160
    {
161
        return ! $this->isSupported($locale);
162
    }
163
164
    /**
165
     * Create a new instance from a value.
166
     *
167
     * @param  string|int  $value
168
     * @param  string  $locale
169
     * @return self
170
     */
171
    public static function parse($value, string $locale)
172
    {
173
        return new static($value, $locale);
174
    }
175
176
    /**
177
     * Parse the name of the weekday based on the value.
178
     *
179
     * @param  int  $value
180
     * @param  string  $locale
181
     * @return string
182
     */
183
    public function parseName(int $value, string $locale = null) : string
184
    {
185
        if ($value < 0 || $value > 6) {
186
            throw new InvalidArgumentException(
187
                "The provided value ($value) is not a valid weekday."
188
            );
189
        }
190
191
        return array_values(static::getNames($locale ?: $this->locale))[$value];
192
    }
193
194
    /**
195
     * Parse the value from the weekday name.
196
     *
197
     * @param  string  $name
198
     * @param  string  $locale
199
     * @return int
200
     */
201
    public function parseValue(string $name, string $locale = null) : int
202
    {
203
        $names = array_map(
204
            'strtolower',
205
            static::getNames($locale ?: $this->locale)
206
        );
207
208
        $value = array_search(
209
            strtolower($name),
210
            array_values($names)
211
        );
212
213
        if ($value === false) {
214
            throw new InvalidArgumentException(
215
                sprintf(
216
                    'The value could not be parsed for %s in %s.',
217
                    $name,
218
                    $locale ?: $this->locale
219
                )
220
            );
221
        }
222
223
        return $value;
224
    }
225
226
    /**
227
     * Set the weekday based on the integer or string value.
228
     *
229
     * @param  string|int  $value
230
     * @return self
231
     */
232
    public function set($value) : self
233
    {
234
        if (is_numeric($value)) {
235
            $this->value = $value;
0 ignored issues
show
Documentation Bug introduced by
It seems like $value can also be of type double or string. However, the property $value is declared as type integer. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
236
            $this->name = null;
237
        } else {
238
            $this->name = $value;
239
            $this->value = null;
240
        }
241
242
        return $this;
243
    }
244
245
    /**
246
     * Set the locale of the instance.
247
     *
248
     * @param  string  $locale
249
     * @return self
250
     */
251
    public function setLocale(string $locale) : self
252
    {
253
        if ($locale != $this->locale) {
254
            if ($this->isNotSupported($locale)) {
255
                static::throwNotSupportedLocaleException($locale);
256
            }
257
258
            $this->name = null;
259
            $this->locale = $locale;
260
        }
261
262
        return $this;
263
    }
264
265
    /**
266
     * Throw an exception to let the user know that the locale is not yet
267
     * supported.
268
     *
269
     * @param  string  $locale
270
     * @return void
271
     */
272
    protected static function throwNotSupportedLocaleException(string $locale) : void
273
    {
274
        throw new InvalidArgumentException(
275
            "The locale ($locale) is not yet supported."
276
        );
277
    }
278
279
    /**
280
     * Function to retrieve the name in Afrikaans.
281
     *
282
     * @return string
283
     */
284
    public function inAfrikaans() : string
285
    {
286
        return $this->getName('af');
287
    }
288
289
    /**
290
     * Function to retrieve the name in Albanian.
291
     *
292
     * @return string
293
     */
294
    public function inAlbanian() : string
295
    {
296
        return $this->getName('sq');
297
    }
298
299
    /**
300
     * Function to retrieve the name in Amharic.
301
     *
302
     * @return string
303
     */
304
    public function inAmharic() : string
305
    {
306
        return $this->getName('am');
307
    }
308
309
    /**
310
     * Function to retrieve the name in Arabic.
311
     *
312
     * @return string
313
     */
314
    public function inArabic() : string
315
    {
316
        return $this->getName('ar');
317
    }
318
319
    /**
320
     * Function to retrieve the name in Armenian.
321
     *
322
     * @return string
323
     */
324
    public function inArmenian() : string
325
    {
326
        return $this->getName('hy');
327
    }
328
329
    /**
330
     * Function to retrieve the name in Azerbaijani.
331
     *
332
     * @return string
333
     */
334
    public function inAzerbaijani() : string
335
    {
336
        return $this->getName('az');
337
    }
338
339
    /**
340
     * Function to retrieve the name in Basque.
341
     *
342
     * @return string
343
     */
344
    public function inBasque() : string
345
    {
346
        return $this->getName('eu');
347
    }
348
349
    /**
350
     * Function to retrieve the name in Belarusian.
351
     *
352
     * @return string
353
     */
354
    public function inBelarusian() : string
355
    {
356
        return $this->getName('be');
357
    }
358
359
    /**
360
     * Function to retrieve the name in Bengali.
361
     *
362
     * @return string
363
     */
364
    public function inBengali() : string
365
    {
366
        return $this->getName('bn');
367
    }
368
369
    /**
370
     * Function to retrieve the name in Bosnian.
371
     *
372
     * @return string
373
     */
374
    public function inBosnian() : string
375
    {
376
        return $this->getName('bs');
377
    }
378
379
    /**
380
     * Function to retrieve the name in Bulgarian.
381
     *
382
     * @return string
383
     */
384
    public function inBulgarian() : string
385
    {
386
        return $this->getName('bg');
387
    }
388
389
    /**
390
     * Function to retrieve the name in Catalan.
391
     *
392
     * @return string
393
     */
394
    public function inCatalan() : string
395
    {
396
        return $this->getName('ca');
397
    }
398
399
    /**
400
     * Function to retrieve the name in Cebuano.
401
     *
402
     * @return string
403
     */
404
    public function inCebuano() : string
405
    {
406
        return $this->getName('ceb');
407
    }
408
409
    /**
410
     * Function to retrieve the name in Chichewa.
411
     *
412
     * @return string
413
     */
414
    public function inChichewa() : string
415
    {
416
        return $this->getName('ny');
417
    }
418
419
    /**
420
     * Function to retrieve the name in Chinese (Simplified).
421
     *
422
     * @return string
423
     */
424
    public function inSimplifiedChinese() : string
425
    {
426
        return $this->getName('zh_CN');
427
    }
428
429
    /**
430
     * Function to retrieve the name in Chinese (Traditional).
431
     *
432
     * @return string
433
     */
434
    public function inTraditionalChinese() : string
435
    {
436
        return $this->getName('zh_TW');
437
    }
438
439
    /**
440
     * Function to retrieve the name in Corsican.
441
     *
442
     * @return string
443
     */
444
    public function inCorsican() : string
445
    {
446
        return $this->getName('co');
447
    }
448
449
    /**
450
     * Function to retrieve the name in Croatian.
451
     *
452
     * @return string
453
     */
454
    public function inCroatian() : string
455
    {
456
        return $this->getName('hr');
457
    }
458
459
    /**
460
     * Function to retrieve the name in Czech.
461
     *
462
     * @return string
463
     */
464
    public function inCzech() : string
465
    {
466
        return $this->getName('cs');
467
    }
468
469
    /**
470
     * Function to retrieve the name in Danish.
471
     *
472
     * @return string
473
     */
474
    public function inDanish() : string
475
    {
476
        return $this->getName('da');
477
    }
478
479
    /**
480
     * Function to retrieve the name in Dutch.
481
     *
482
     * @return string
483
     */
484
    public function inDutch() : string
485
    {
486
        return $this->getName('nl');
487
    }
488
489
    /**
490
     * Function to retrieve the name in English.
491
     *
492
     * @return string
493
     */
494
    public function inEnglish() : string
495
    {
496
        return $this->getName('en');
497
    }
498
499
    /**
500
     * Function to retrieve the name in Esperanto.
501
     *
502
     * @return string
503
     */
504
    public function inEsperanto() : string
505
    {
506
        return $this->getName('eo');
507
    }
508
509
    /**
510
     * Function to retrieve the name in Estonian.
511
     *
512
     * @return string
513
     */
514
    public function inEstonian() : string
515
    {
516
        return $this->getName('et');
517
    }
518
519
    /**
520
     * Function to retrieve the name in Filipino.
521
     *
522
     * @return string
523
     */
524
    public function inFilipino() : string
525
    {
526
        return $this->getName('tl');
527
    }
528
529
    /**
530
     * Function to retrieve the name in Finnish.
531
     *
532
     * @return string
533
     */
534
    public function inFinnish() : string
535
    {
536
        return $this->getName('fi');
537
    }
538
539
    /**
540
     * Function to retrieve the name in French.
541
     *
542
     * @return string
543
     */
544
    public function inFrench() : string
545
    {
546
        return $this->getName('fr');
547
    }
548
549
    /**
550
     * Function to retrieve the name in Frisian.
551
     *
552
     * @return string
553
     */
554
    public function inFrisian() : string
555
    {
556
        return $this->getName('fy');
557
    }
558
559
    /**
560
     * Function to retrieve the name in Galician.
561
     *
562
     * @return string
563
     */
564
    public function inGalician() : string
565
    {
566
        return $this->getName('gl');
567
    }
568
569
    /**
570
     * Function to retrieve the name in Georgian.
571
     *
572
     * @return string
573
     */
574
    public function inGeorgian() : string
575
    {
576
        return $this->getName('ka');
577
    }
578
579
    /**
580
     * Function to retrieve the name in German.
581
     *
582
     * @return string
583
     */
584
    public function inGerman() : string
585
    {
586
        return $this->getName('de');
587
    }
588
589
    /**
590
     * Function to retrieve the name in Greek.
591
     *
592
     * @return string
593
     */
594
    public function inGreek() : string
595
    {
596
        return $this->getName('el');
597
    }
598
599
    /**
600
     * Function to retrieve the name in Gujarati.
601
     *
602
     * @return string
603
     */
604
    public function inGujarati() : string
605
    {
606
        return $this->getName('gu');
607
    }
608
609
    /**
610
     * Function to retrieve the name in Haitian Creole.
611
     *
612
     * @return string
613
     */
614
    public function inHaitianCreole() : string
615
    {
616
        return $this->getName('ht');
617
    }
618
619
    /**
620
     * Function to retrieve the name in Hausa.
621
     *
622
     * @return string
623
     */
624
    public function inHausa() : string
625
    {
626
        return $this->getName('ha');
627
    }
628
629
    /**
630
     * Function to retrieve the name in Hawaiian.
631
     *
632
     * @return string
633
     */
634
    public function inHawaiian() : string
635
    {
636
        return $this->getName('haw');
637
    }
638
639
    /**
640
     * Function to retrieve the name in Hebrew.
641
     *
642
     * @return string
643
     */
644
    public function inHebrew() : string
645
    {
646
        return $this->getName('iw');
647
    }
648
649
    /**
650
     * Function to retrieve the name in Hindi.
651
     *
652
     * @return string
653
     */
654
    public function inHindi() : string
655
    {
656
        return $this->getName('hi');
657
    }
658
659
    /**
660
     * Function to retrieve the name in Hmong.
661
     *
662
     * @return string
663
     */
664
    public function inHmong() : string
665
    {
666
        return $this->getName('hmn');
667
    }
668
669
    /**
670
     * Function to retrieve the name in Hungarian.
671
     *
672
     * @return string
673
     */
674
    public function inHungarian() : string
675
    {
676
        return $this->getName('hu');
677
    }
678
679
    /**
680
     * Function to retrieve the name in Icelandic.
681
     *
682
     * @return string
683
     */
684
    public function inIcelandic() : string
685
    {
686
        return $this->getName('is');
687
    }
688
689
    /**
690
     * Function to retrieve the name in Igbo.
691
     *
692
     * @return string
693
     */
694
    public function inIgbo() : string
695
    {
696
        return $this->getName('ig');
697
    }
698
699
    /**
700
     * Function to retrieve the name in Indonesian.
701
     *
702
     * @return string
703
     */
704
    public function inIndonesian() : string
705
    {
706
        return $this->getName('id');
707
    }
708
709
    /**
710
     * Function to retrieve the name in Irish.
711
     *
712
     * @return string
713
     */
714
    public function inIrish() : string
715
    {
716
        return $this->getName('ga');
717
    }
718
719
    /**
720
     * Function to retrieve the name in Italian.
721
     *
722
     * @return string
723
     */
724
    public function inItalian() : string
725
    {
726
        return $this->getName('it');
727
    }
728
729
    /**
730
     * Function to retrieve the name in Japanese.
731
     *
732
     * @return string
733
     */
734
    public function inJapanese() : string
735
    {
736
        return $this->getName('ja');
737
    }
738
739
    /**
740
     * Function to retrieve the name in Javanese.
741
     *
742
     * @return string
743
     */
744
    public function inJavanese() : string
745
    {
746
        return $this->getName('jw');
747
    }
748
749
    /**
750
     * Function to retrieve the name in Kannada.
751
     *
752
     * @return string
753
     */
754
    public function inKannada() : string
755
    {
756
        return $this->getName('kn');
757
    }
758
759
    /**
760
     * Function to retrieve the name in Kazakh.
761
     *
762
     * @return string
763
     */
764
    public function inKazakh() : string
765
    {
766
        return $this->getName('kk');
767
    }
768
769
    /**
770
     * Function to retrieve the name in Khmer.
771
     *
772
     * @return string
773
     */
774
    public function inKhmer() : string
775
    {
776
        return $this->getName('km');
777
    }
778
779
    /**
780
     * Function to retrieve the name in Korean.
781
     *
782
     * @return string
783
     */
784
    public function inKorean() : string
785
    {
786
        return $this->getName('ko');
787
    }
788
789
    /**
790
     * Function to retrieve the name in Kurdish (Kurmanji).
791
     *
792
     * @return string
793
     */
794
    public function inKurmanjiKurdish() : string
795
    {
796
        return $this->getName('ku');
797
    }
798
799
    /**
800
     * Function to retrieve the name in Kyrgyz.
801
     *
802
     * @return string
803
     */
804
    public function inKyrgyz() : string
805
    {
806
        return $this->getName('ky');
807
    }
808
809
    /**
810
     * Function to retrieve the name in Lao.
811
     *
812
     * @return string
813
     */
814
    public function inLao() : string
815
    {
816
        return $this->getName('lo');
817
    }
818
819
    /**
820
     * Function to retrieve the name in Latin.
821
     *
822
     * @return string
823
     */
824
    public function inLatin() : string
825
    {
826
        return $this->getName('la');
827
    }
828
829
    /**
830
     * Function to retrieve the name in Latvian.
831
     *
832
     * @return string
833
     */
834
    public function inLatvian() : string
835
    {
836
        return $this->getName('lv');
837
    }
838
839
    /**
840
     * Function to retrieve the name in Lithuanian.
841
     *
842
     * @return string
843
     */
844
    public function inLithuanian() : string
845
    {
846
        return $this->getName('lt');
847
    }
848
849
    /**
850
     * Function to retrieve the name in Luxembourgish.
851
     *
852
     * @return string
853
     */
854
    public function inLuxembourgish() : string
855
    {
856
        return $this->getName('lb');
857
    }
858
859
    /**
860
     * Function to retrieve the name in Macedonian.
861
     *
862
     * @return string
863
     */
864
    public function inMacedonian() : string
865
    {
866
        return $this->getName('mk');
867
    }
868
869
    /**
870
     * Function to retrieve the name in Malagasy.
871
     *
872
     * @return string
873
     */
874
    public function inMalagasy() : string
875
    {
876
        return $this->getName('mg');
877
    }
878
879
    /**
880
     * Function to retrieve the name in Malay.
881
     *
882
     * @return string
883
     */
884
    public function inMalay() : string
885
    {
886
        return $this->getName('ms');
887
    }
888
889
    /**
890
     * Function to retrieve the name in Malayalam.
891
     *
892
     * @return string
893
     */
894
    public function inMalayalam() : string
895
    {
896
        return $this->getName('ml');
897
    }
898
899
    /**
900
     * Function to retrieve the name in Maltese.
901
     *
902
     * @return string
903
     */
904
    public function inMaltese() : string
905
    {
906
        return $this->getName('mt');
907
    }
908
909
    /**
910
     * Function to retrieve the name in Maori.
911
     *
912
     * @return string
913
     */
914
    public function inMaori() : string
915
    {
916
        return $this->getName('mi');
917
    }
918
919
    /**
920
     * Function to retrieve the name in Marathi.
921
     *
922
     * @return string
923
     */
924
    public function inMarathi() : string
925
    {
926
        return $this->getName('mr');
927
    }
928
929
    /**
930
     * Function to retrieve the name in Mongolian.
931
     *
932
     * @return string
933
     */
934
    public function inMongolian() : string
935
    {
936
        return $this->getName('mn');
937
    }
938
939
    /**
940
     * Function to retrieve the name in Myanmar (Burmese).
941
     *
942
     * @return string
943
     */
944
    public function inBurmeseMyanmar() : string
945
    {
946
        return $this->getName('my');
947
    }
948
949
    /**
950
     * Function to retrieve the name in Nepali.
951
     *
952
     * @return string
953
     */
954
    public function inNepali() : string
955
    {
956
        return $this->getName('ne');
957
    }
958
959
    /**
960
     * Function to retrieve the name in Norwegian.
961
     *
962
     * @return string
963
     */
964
    public function inNorwegian() : string
965
    {
966
        return $this->getName('no');
967
    }
968
969
    /**
970
     * Function to retrieve the name in Pashto.
971
     *
972
     * @return string
973
     */
974
    public function inPashto() : string
975
    {
976
        return $this->getName('ps');
977
    }
978
979
    /**
980
     * Function to retrieve the name in Persian.
981
     *
982
     * @return string
983
     */
984
    public function inPersian() : string
985
    {
986
        return $this->getName('fa');
987
    }
988
989
    /**
990
     * Function to retrieve the name in Polish.
991
     *
992
     * @return string
993
     */
994
    public function inPolish() : string
995
    {
996
        return $this->getName('pl');
997
    }
998
999
    /**
1000
     * Function to retrieve the name in Portuguese.
1001
     *
1002
     * @return string
1003
     */
1004
    public function inPortuguese() : string
1005
    {
1006
        return $this->getName('pt');
1007
    }
1008
1009
    /**
1010
     * Function to retrieve the name in Punjabi.
1011
     *
1012
     * @return string
1013
     */
1014
    public function inPunjabi() : string
1015
    {
1016
        return $this->getName('pa');
1017
    }
1018
1019
    /**
1020
     * Function to retrieve the name in Romanian.
1021
     *
1022
     * @return string
1023
     */
1024
    public function inRomanian() : string
1025
    {
1026
        return $this->getName('ro');
1027
    }
1028
1029
    /**
1030
     * Function to retrieve the name in Russian.
1031
     *
1032
     * @return string
1033
     */
1034
    public function inRussian() : string
1035
    {
1036
        return $this->getName('ru');
1037
    }
1038
1039
    /**
1040
     * Function to retrieve the name in Samoan.
1041
     *
1042
     * @return string
1043
     */
1044
    public function inSamoan() : string
1045
    {
1046
        return $this->getName('sm');
1047
    }
1048
1049
    /**
1050
     * Function to retrieve the name in Scots Gaelic.
1051
     *
1052
     * @return string
1053
     */
1054
    public function inScotsGaelic() : string
1055
    {
1056
        return $this->getName('gd');
1057
    }
1058
1059
    /**
1060
     * Function to retrieve the name in Serbian.
1061
     *
1062
     * @return string
1063
     */
1064
    public function inSerbian() : string
1065
    {
1066
        return $this->getName('sr');
1067
    }
1068
1069
    /**
1070
     * Function to retrieve the name in Sesotho.
1071
     *
1072
     * @return string
1073
     */
1074
    public function inSesotho() : string
1075
    {
1076
        return $this->getName('st');
1077
    }
1078
1079
    /**
1080
     * Function to retrieve the name in Shona.
1081
     *
1082
     * @return string
1083
     */
1084
    public function inShona() : string
1085
    {
1086
        return $this->getName('sn');
1087
    }
1088
1089
    /**
1090
     * Function to retrieve the name in Sindhi.
1091
     *
1092
     * @return string
1093
     */
1094
    public function inSindhi() : string
1095
    {
1096
        return $this->getName('sd');
1097
    }
1098
1099
    /**
1100
     * Function to retrieve the name in Sinhala.
1101
     *
1102
     * @return string
1103
     */
1104
    public function inSinhala() : string
1105
    {
1106
        return $this->getName('si');
1107
    }
1108
1109
    /**
1110
     * Function to retrieve the name in Slovak.
1111
     *
1112
     * @return string
1113
     */
1114
    public function inSlovak() : string
1115
    {
1116
        return $this->getName('sk');
1117
    }
1118
1119
    /**
1120
     * Function to retrieve the name in Slovenian.
1121
     *
1122
     * @return string
1123
     */
1124
    public function inSlovenian() : string
1125
    {
1126
        return $this->getName('sl');
1127
    }
1128
1129
    /**
1130
     * Function to retrieve the name in Somali.
1131
     *
1132
     * @return string
1133
     */
1134
    public function inSomali() : string
1135
    {
1136
        return $this->getName('so');
1137
    }
1138
1139
    /**
1140
     * Function to retrieve the name in Spanish.
1141
     *
1142
     * @return string
1143
     */
1144
    public function inSpanish() : string
1145
    {
1146
        return $this->getName('es');
1147
    }
1148
1149
    /**
1150
     * Function to retrieve the name in Sundanese.
1151
     *
1152
     * @return string
1153
     */
1154
    public function inSundanese() : string
1155
    {
1156
        return $this->getName('su');
1157
    }
1158
1159
    /**
1160
     * Function to retrieve the name in Swahili.
1161
     *
1162
     * @return string
1163
     */
1164
    public function inSwahili() : string
1165
    {
1166
        return $this->getName('sw');
1167
    }
1168
1169
    /**
1170
     * Function to retrieve the name in Swedish.
1171
     *
1172
     * @return string
1173
     */
1174
    public function inSwedish() : string
1175
    {
1176
        return $this->getName('sv');
1177
    }
1178
1179
    /**
1180
     * Function to retrieve the name in Tajik.
1181
     *
1182
     * @return string
1183
     */
1184
    public function inTajik() : string
1185
    {
1186
        return $this->getName('tg');
1187
    }
1188
1189
    /**
1190
     * Function to retrieve the name in Tamil.
1191
     *
1192
     * @return string
1193
     */
1194
    public function inTamil() : string
1195
    {
1196
        return $this->getName('ta');
1197
    }
1198
1199
    /**
1200
     * Function to retrieve the name in Telugu.
1201
     *
1202
     * @return string
1203
     */
1204
    public function inTelugu() : string
1205
    {
1206
        return $this->getName('te');
1207
    }
1208
1209
    /**
1210
     * Function to retrieve the name in Thai.
1211
     *
1212
     * @return string
1213
     */
1214
    public function inThai() : string
1215
    {
1216
        return $this->getName('th');
1217
    }
1218
1219
    /**
1220
     * Function to retrieve the name in Turkish.
1221
     *
1222
     * @return string
1223
     */
1224
    public function inTurkish() : string
1225
    {
1226
        return $this->getName('tr');
1227
    }
1228
1229
    /**
1230
     * Function to retrieve the name in Ukrainian.
1231
     *
1232
     * @return string
1233
     */
1234
    public function inUkrainian() : string
1235
    {
1236
        return $this->getName('uk');
1237
    }
1238
1239
    /**
1240
     * Function to retrieve the name in Urdu.
1241
     *
1242
     * @return string
1243
     */
1244
    public function inUrdu() : string
1245
    {
1246
        return $this->getName('ur');
1247
    }
1248
1249
    /**
1250
     * Function to retrieve the name in Uzbek.
1251
     *
1252
     * @return string
1253
     */
1254
    public function inUzbek() : string
1255
    {
1256
        return $this->getName('uz');
1257
    }
1258
1259
    /**
1260
     * Function to retrieve the name in Vietnamese.
1261
     *
1262
     * @return string
1263
     */
1264
    public function inVietnamese() : string
1265
    {
1266
        return $this->getName('vi');
1267
    }
1268
1269
    /**
1270
     * Function to retrieve the name in Welsh.
1271
     *
1272
     * @return string
1273
     */
1274
    public function inWelsh() : string
1275
    {
1276
        return $this->getName('cy');
1277
    }
1278
1279
    /**
1280
     * Function to retrieve the name in Xhosa.
1281
     *
1282
     * @return string
1283
     */
1284
    public function inXhosa() : string
1285
    {
1286
        return $this->getName('xh');
1287
    }
1288
1289
    /**
1290
     * Function to retrieve the name in Yiddish.
1291
     *
1292
     * @return string
1293
     */
1294
    public function inYiddish() : string
1295
    {
1296
        return $this->getName('yi');
1297
    }
1298
1299
    /**
1300
     * Function to retrieve the name in Yoruba.
1301
     *
1302
     * @return string
1303
     */
1304
    public function inYoruba() : string
1305
    {
1306
        return $this->getName('yo');
1307
    }
1308
1309
    /**
1310
     * Function to retrieve the name in Zulu.
1311
     *
1312
     * @return string
1313
     */
1314
    public function inZulu() : string
1315
    {
1316
        return $this->getName('zu');
1317
    }
1318
}
1319