Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
60.00% |
9 / 15 |
|
90.00% |
9 / 10 |
CRAP | |
0.00% |
0 / 1 |
| UserLanguageProficiencyLevel | |
60.00% |
9 / 15 |
|
90.00% |
9 / 10 |
16.40 | |
0.00% |
0 / 1 |
| accept | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| __toString | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
| getIdentity | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setIdentity | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getUser | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setUser | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getLanguage | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setLanguage | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getProficiencyLevel | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setProficiencyLevel | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\WikispeechSpeechDataCollector\Domain; |
| 4 | |
| 5 | /** |
| 6 | * @file |
| 7 | * @ingroup Extensions |
| 8 | * @license GPL-2.0-or-later |
| 9 | */ |
| 10 | |
| 11 | /** |
| 12 | * How well a {@link User} understands a given {@link Language} |
| 13 | * in written or spoken form. |
| 14 | * |
| 15 | * @since 0.1.0 |
| 16 | */ |
| 17 | class UserLanguageProficiencyLevel implements Persistent { |
| 18 | /** @var string|null 128 bits UUID */ |
| 19 | private $identity; |
| 20 | |
| 21 | /** |
| 22 | * @var string|null 128 bits UUID |
| 23 | * @see User::$identity |
| 24 | */ |
| 25 | private $user; |
| 26 | |
| 27 | /** |
| 28 | * @var string|null 128 bits UUID |
| 29 | * @see Language::$identity |
| 30 | */ |
| 31 | private $language; |
| 32 | |
| 33 | /** |
| 34 | * @var int|null |
| 35 | * @see LanguageProficiencyLevel |
| 36 | */ |
| 37 | private $proficiencyLevel; |
| 38 | |
| 39 | // visitor |
| 40 | |
| 41 | /** |
| 42 | * @param PersistentVisitor $visitor |
| 43 | * @return mixed|null |
| 44 | */ |
| 45 | public function accept( PersistentVisitor $visitor ) { |
| 46 | return $visitor->visitUserLanguageProficiencyLevel( $this ); |
| 47 | } |
| 48 | |
| 49 | public function __toString(): string { |
| 50 | return '[ ' . |
| 51 | 'identity => "' . $this->getIdentity() . '", ' . |
| 52 | 'user => "' . $this->getUser() . '", ' . |
| 53 | 'language => "' . $this->getLanguage() . '", ' . |
| 54 | 'proficiencyLevel => "' . $this->getProficiencyLevel() . '" ' . |
| 55 | ']'; |
| 56 | } |
| 57 | |
| 58 | // getters and setters |
| 59 | |
| 60 | /** |
| 61 | * @see UserLanguageProficiencyLevel::$identity |
| 62 | * @return string|null |
| 63 | */ |
| 64 | public function getIdentity(): ?string { |
| 65 | return $this->identity; |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * @see UserLanguageProficiencyLevel::$identity |
| 70 | * @param string|null $identity |
| 71 | */ |
| 72 | public function setIdentity( $identity ): void { |
| 73 | $this->identity = $identity; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * @see UserLanguageProficiencyLevel::$user |
| 78 | * @return string|null |
| 79 | */ |
| 80 | public function getUser(): ?string { |
| 81 | return $this->user; |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * @see UserLanguageProficiencyLevel::$user |
| 86 | * @param string|null $user |
| 87 | */ |
| 88 | public function setUser( ?string $user ): void { |
| 89 | $this->user = $user; |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * @see UserLanguageProficiencyLevel::$language |
| 94 | * @return string|null |
| 95 | */ |
| 96 | public function getLanguage(): ?string { |
| 97 | return $this->language; |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * @see UserLanguageProficiencyLevel::$language |
| 102 | * @param string|null $language |
| 103 | */ |
| 104 | public function setLanguage( ?string $language ): void { |
| 105 | $this->language = $language; |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * @see UserLanguageProficiencyLevel::$proficiencyLevel |
| 110 | * @return int|null |
| 111 | */ |
| 112 | public function getProficiencyLevel(): ?int { |
| 113 | return $this->proficiencyLevel; |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * @see UserLanguageProficiencyLevel::$proficiencyLevel |
| 118 | * @param int|null $proficiencyLevel |
| 119 | */ |
| 120 | public function setProficiencyLevel( ?int $proficiencyLevel ): void { |
| 121 | $this->proficiencyLevel = $proficiencyLevel; |
| 122 | } |
| 123 | } |