Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
60.00% covered (warning)
60.00%
9 / 15
90.00% covered (success)
90.00%
9 / 10
CRAP
0.00% covered (danger)
0.00%
0 / 1
ManuscriptPrompt
60.00% covered (warning)
60.00%
9 / 15
90.00% covered (success)
90.00%
9 / 10
16.40
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 / 6
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
 getManuscript
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setManuscript
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getIndex
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setIndex
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getContent
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setContent
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 * Immutable (once there is at least one recording pointing at the instance).
13 *
14 * An ordered part of text in a {@link Manuscript}. A {@link Recording} is
15 * the audio representation of a manuscript prompt.
16 *
17 * @todo Consider adding information about how difficult the content of
18 *  the prompt is to read, and try feeding new users with as simple text as
19 *  possible to not scare them away from this system.
20 *
21 * @since 0.1.0
22 */
23class ManuscriptPrompt implements Persistent {
24    /** @var string|null 128 bits UUID */
25    private $identity;
26
27    /**
28     * @var string|null 128 bits UUID
29     * @see Manuscript::$identity
30     */
31    private $manuscript;
32
33    /** @var int|null Index order of this text in complete manuscript. */
34    private $index;
35
36    /** @var string|null Text content */
37    private $content;
38
39    // visitor
40
41    /**
42     * @param PersistentVisitor $visitor
43     * @return mixed|null
44     */
45    public function accept( PersistentVisitor $visitor ) {
46        return $visitor->visitManuscriptPrompt( $this );
47    }
48
49    public function __toString(): string {
50        return '[ ' .
51            'identity => "' . $this->getIdentity() . '", ' .
52            'manuscript => "' . $this->getManuscript() . '", ' .
53            'index => "' . $this->getIndex() . '", ' .
54            'content => "' . $this->getContent() . '" ' .
55            ']';
56    }
57
58    // getters and setters
59
60    /**
61     * @see ManuscriptPrompt::$identity
62     * @return string|null
63     */
64    public function getIdentity(): ?string {
65        return $this->identity;
66    }
67
68    /**
69     * @see ManuscriptPrompt::$identity
70     * @param string|null $identity
71     */
72    public function setIdentity( $identity ): void {
73        $this->identity = $identity;
74    }
75
76    /**
77     * @see ManuscriptPrompt::$manuscript
78     * @return string|null
79     */
80    public function getManuscript(): ?string {
81        return $this->manuscript;
82    }
83
84    /**
85     * @see ManuscriptPrompt::$manuscript
86     * @param string|null $manuscript
87     */
88    public function setManuscript( ?string $manuscript ): void {
89        $this->manuscript = $manuscript;
90    }
91
92    /**
93     * @see ManuscriptPrompt::$index
94     * @return int|null
95     */
96    public function getIndex(): ?int {
97        return $this->index;
98    }
99
100    /**
101     * @see ManuscriptPrompt::$index
102     * @param int|null $index
103     */
104    public function setIndex( ?int $index ): void {
105        $this->index = $index;
106    }
107
108    /**
109     * @see ManuscriptPrompt::$content
110     * @return string|null
111     */
112    public function getContent(): ?string {
113        return $this->content;
114    }
115
116    /**
117     * @see ManuscriptPrompt::$content
118     * @param string|null $content
119     */
120    public function setContent( ?string $content ): void {
121        $this->content = $content;
122    }
123}