Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
61.90% covered (warning)
61.90%
13 / 21
92.86% covered (success)
92.86%
13 / 14
CRAP
0.00% covered (danger)
0.00%
0 / 1
Language
61.90% covered (warning)
61.90%
13 / 21
92.86% covered (success)
92.86%
13 / 14
24.84
0.00% covered (danger)
0.00%
0 / 1
 accept
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 __toString
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
2
 getIdentity
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setIdentity
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getNativeName
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setNativeName
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getIso639a1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setIso639a1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getIso639a2b
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setIso639a2b
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getIso639a2t
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setIso639a2t
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getIso639a3
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setIso639a3
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace MediaWiki\WikispeechSpeechDataCollector\Domain;
4
5/**
6 * @file
7 * @ingroup Extensions
8 * @license GPL-2.0-or-later
9 */
10
11/**
12 * All languages in the world does not exist in all ISO639-codes. Thus in order
13 * to really keep track of them we need to keep track of all ISO639-codes.
14 * However, ISO639-codes are meant to be compositely unique. So for instance a
15 * code available in 639-2t should never be another language in 639-3. It might
16 * thus be enough to keep a list of 639-codes per language rather than keeping
17 * track of specific codes per 639-grouping.
18 *
19 * @since 0.1.0
20 */
21class Language implements Persistent {
22    /** @var string|null 128 bits UUID */
23    private $identity;
24
25    /** @var string|null Name of language in that language, e.g. 'English'. */
26    private $nativeName;
27
28    /** @var string|null https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes */
29    private $iso639a1;
30
31    /** @var string|null https://en.wikipedia.org/wiki/ISO_639-2 */
32    private $iso639a2b;
33
34    /** @var string|null https://en.wikipedia.org/wiki/ISO_639-2 */
35    private $iso639a2t;
36
37    /** @var string|null https://en.wikipedia.org/wiki/ISO_639-3 */
38    private $iso639a3;
39
40    // visitor
41
42    /**
43     * @param PersistentVisitor $visitor
44     * @return mixed|null
45     */
46    public function accept( PersistentVisitor $visitor ) {
47        return $visitor->visitLanguage( $this );
48    }
49
50    public function __toString(): string {
51        return '[ ' .
52            'identity => "' . $this->getIdentity() . '", ' .
53            'nativeName => "' . $this->getNativeName() . '", ' .
54            'iso639a1 => "' . $this->getIso639a1() . '", ' .
55            'iso639a2b => "' . $this->getIso639a2b() . '", ' .
56            'iso639a2t => "' . $this->getIso639a2t() . '", ' .
57            'iso639a3 => "' . $this->getIso639a3() . '" ' .
58            ']';
59    }
60
61    // getters and setters
62
63    /**
64     * @see Language::$identity
65     * @return string|null
66     */
67    public function getIdentity(): ?string {
68        return $this->identity;
69    }
70
71    /**
72     * @see Language::$identity
73     * @param string|null $identity
74     */
75    public function setIdentity( $identity ): void {
76        $this->identity = $identity;
77    }
78
79    /**
80     * @see Language::$nativeName
81     * @return string|null
82     */
83    public function getNativeName(): ?string {
84        return $this->nativeName;
85    }
86
87    /**
88     * @see Language::$nativeName
89     * @param string|null $nativeName
90     */
91    public function setNativeName( ?string $nativeName ): void {
92        $this->nativeName = $nativeName;
93    }
94
95    /**
96     * @see Language::$iso639a1
97     * @return string|null
98     */
99    public function getIso639a1(): ?string {
100        return $this->iso639a1;
101    }
102
103    /**
104     * @see Language::$iso639a1
105     * @param string|null $iso639a1
106     */
107    public function setIso639a1( ?string $iso639a1 ): void {
108        $this->iso639a1 = $iso639a1;
109    }
110
111    /**
112     * @see Language::$iso639a2b
113     * @return string|null
114     */
115    public function getIso639a2b(): ?string {
116        return $this->iso639a2b;
117    }
118
119    /**
120     * @see Language::$iso639a2b
121     * @param string|null $iso639a2b
122     */
123    public function setIso639a2b( ?string $iso639a2b ): void {
124        $this->iso639a2b = $iso639a2b;
125    }
126
127    /**
128     * @see Language::$iso639a2t
129     * @return string|null
130     */
131    public function getIso639a2t(): ?string {
132        return $this->iso639a2t;
133    }
134
135    /**
136     * @see Language::$iso639a2t
137     * @param string|null $iso639a2t
138     */
139    public function setIso639a2t( ?string $iso639a2t ): void {
140        $this->iso639a2t = $iso639a2t;
141    }
142
143    /**
144     * @see Language::$iso639a3
145     * @return string|null
146     */
147    public function getIso639a3(): ?string {
148        return $this->iso639a3;
149    }
150
151    /**
152     * @see Language::$iso639a3
153     * @param string|null $iso639a3
154     */
155    public function setIso639a3( ?string $iso639a3 ): void {
156        $this->iso639a3 = $iso639a3;
157    }
158}