Completed
Push — master ( 69ec8b...199d88 )
by Tõnis
02:10
created

BaseQuestion::getQuestionTexts()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace dameter\abstracts\models;
4
5
use dameter\abstracts\interfaces\WithLanguageSettingInterface;
6
use dameter\abstracts\validators\VariableNameValidator;
7
8
9
/**
10
 * Class BaseQuestion
11
 * @property integer $question_id
12
 * @property integer $survey_id
13
 * @property string $code Question code is like eg a variable name in SPSS. A relatively short no-spaces survey-wide unique identifier
14
 *
15
 * @property BaseAnswer[] $answers
16
 *
17
 * @package dameter\abstracts\models
18
 * @author Tõnis Ormisson <[email protected]>
19
 */
20
class BaseQuestion extends WithSurveyModel implements WithLanguageSettingInterface
21
{
22
    /** @var Language */
23
    public $language;
24
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function init()
30
    {
31
        parent::init();
32
        if (empty($this->language)) {
33
            $this->language = $this->survey->language;
34
        }
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function rules()
41
    {
42
        return array_merge(parent::rules(), [
43
            [['code'], 'required'],
44
            [['code'], VariableNameValidator::class],
45
        ]);
46
    }
47
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getAnswers()
53
    {
54
        return $this->hasMany(BaseSurvey::class);
55
    }
56
57
58
    /**
59
     * {@inheritdoc}
60
     */
61
    public function getQuestionTexts()
62
    {
63
    }
64
}