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
SkippedManuscriptPrompt
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
 getManuscriptPrompt
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setManuscriptPrompt
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getUser
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setUser
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getSkipped
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setSkipped
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
11use MWTimestamp;
12
13/**
14 * Indication that a {@link User} skipped recording
15 * a specific {@link ManuscriptPrompt}.
16 *
17 * @todo Consider allowing a reason for skipping,
18 *  e.g. too complex pronunciation, foul language, etc.
19 *
20 * In the future, this could easily be mined together in conjunction with
21 * {@link UserLanguageProficiencyLevel::$proficiencyLevel}
22 * in order to figure out what prompts to not expose to new users
23 * and thus make onboarding as easy as possible rather than scare them
24 * away with hard to read sentences.
25 *
26 * Tokenized {@link ManuscriptPrompt::$content} with above mentioned data
27 * could also be used to guess hard to read sentences in prompts that has
28 * never been exposed to users.
29 *
30 * @since 0.1.0
31 */
32class SkippedManuscriptPrompt implements Persistent {
33    /** @var string|null 128 bits UUID */
34    private $identity;
35
36    /**
37     * @var string|null 128 bits UUID
38     * @see Manuscript::$identity
39     */
40    private $manuscriptPrompt;
41
42    /**
43     * @var string|null 128 bits UUID
44     * @see User::$identity
45     */
46    private $user;
47
48    /** @var MWTimestamp|null Timestamp skipped */
49    private $skipped;
50
51    // visitor
52
53    /**
54     * @param PersistentVisitor $visitor
55     * @return mixed|null
56     */
57    public function accept( PersistentVisitor $visitor ) {
58        return $visitor->visitSkippedManuscriptPrompt( $this );
59    }
60
61    public function __toString(): string {
62        return '[ ' .
63            'identity => "' . $this->getIdentity() . '", ' .
64            'manuscriptPrompt => "' . $this->getManuscriptPrompt() . '", ' .
65            'user => "' . $this->getUser() . '", ' .
66            'skipped => "' . $this->getSkipped() . '" ' .
67            ']';
68    }
69
70    // getters and setters
71
72    /**
73     * @see SkippedManuscriptPrompt::$identity
74     * @return string|null
75     */
76    public function getIdentity(): ?string {
77        return $this->identity;
78    }
79
80    /**
81     * @see SkippedManuscriptPrompt::$identity
82     * @param string|null $identity
83     */
84    public function setIdentity( $identity ): void {
85        $this->identity = $identity;
86    }
87
88    /**
89     * @see SkippedManuscriptPrompt::$manuscriptPrompt
90     * @return string|null
91     */
92    public function getManuscriptPrompt(): ?string {
93        return $this->manuscriptPrompt;
94    }
95
96    /**
97     * @see SkippedManuscriptPrompt::$manuscriptPrompt
98     * @param string|null $manuscriptPrompt
99     */
100    public function setManuscriptPrompt( ?string $manuscriptPrompt ): void {
101        $this->manuscriptPrompt = $manuscriptPrompt;
102    }
103
104    /**
105     * @see SkippedManuscriptPrompt::$user
106     * @return string|null
107     */
108    public function getUser(): ?string {
109        return $this->user;
110    }
111
112    /**
113     * @see SkippedManuscriptPrompt::$user
114     * @param string|null $user
115     */
116    public function setUser( ?string $user ): void {
117        $this->user = $user;
118    }
119
120    /**
121     * @see SkippedManuscriptPrompt::$skipped
122     * @return MWTimestamp|null
123     */
124    public function getSkipped(): ?MWTimestamp {
125        return $this->skipped;
126    }
127
128    /**
129     * @see SkippedManuscriptPrompt::$skipped
130     * @param MWTimestamp|null $skipped
131     */
132    public function setSkipped( ?MWTimestamp $skipped ): void {
133        $this->skipped = $skipped;
134    }
135}