Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
29.41% |
5 / 17 |
|
83.33% |
5 / 6 |
CRAP | |
0.00% |
0 / 1 |
RecordingAnnotations | |
29.41% |
5 / 17 |
|
83.33% |
5 / 6 |
30.51 | |
0.00% |
0 / 1 |
accept | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
__toString | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
12 | |||
getIdentity | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setIdentity | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getItems | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setItems | |
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 | * A list of {@link RecordingAnnotation} associated with a {@link Recording}. |
13 | * |
14 | * @since 0.1.0 |
15 | */ |
16 | class RecordingAnnotations implements Persistent { |
17 | /** |
18 | * Inherited from composite owning Recording. |
19 | * |
20 | * @var string|null 128 bits UUID |
21 | * @see Recording::$identity |
22 | */ |
23 | private $identity; |
24 | |
25 | /** |
26 | * @var RecordingAnnotation[]|null |
27 | */ |
28 | private $items; |
29 | |
30 | // visitor |
31 | |
32 | /** |
33 | * @param PersistentVisitor $visitor |
34 | * @return mixed |
35 | */ |
36 | public function accept( PersistentVisitor $visitor ) { |
37 | return $visitor->visitRecordingAnnotations( $this ); |
38 | } |
39 | |
40 | public function __toString(): string { |
41 | $string = '[ ' . |
42 | 'identity => "' . $this->getIdentity() . '", ' . |
43 | 'items => '; |
44 | if ( $this->getItems() === null ) { |
45 | $string .= 'null'; |
46 | } else { |
47 | $string .= '['; |
48 | foreach ( $this->getItems() as $recordingAnnotation ) { |
49 | $string .= $recordingAnnotation; |
50 | $string .= ', '; |
51 | } |
52 | $string .= ']'; |
53 | } |
54 | $string .= ' ]'; |
55 | return $string; |
56 | } |
57 | |
58 | // getters and setters |
59 | |
60 | /** |
61 | * @see RecordingAnnotation::$identity |
62 | * @return string|null |
63 | */ |
64 | public function getIdentity(): ?string { |
65 | return $this->identity; |
66 | } |
67 | |
68 | /** |
69 | * @see RecordingAnnotation::$identity |
70 | * @param string|null $identity |
71 | */ |
72 | public function setIdentity( $identity ): void { |
73 | $this->identity = $identity; |
74 | } |
75 | |
76 | /** |
77 | * @return RecordingAnnotation[]|null |
78 | */ |
79 | public function getItems(): ?array { |
80 | return $this->items; |
81 | } |
82 | |
83 | /** |
84 | * @param RecordingAnnotation[]|null $items |
85 | */ |
86 | public function setItems( ?array $items ): void { |
87 | $this->items = $items; |
88 | } |
89 | |
90 | } |