Completed
Pull Request — master (#139)
by
unknown
04:18
created

Fact::getFact()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Yandex\Market\Content\Models;
4
5
use Yandex\Common\Model;
6
7
class Fact extends Model
8
{
9
    protected $fact = null;
10
11
    /**
12
     * Constructor
13
     *
14
     * @param array $data
15
     */
16 4
    public function __construct($data)
17
    {
18
        // fix for opinion pro & contra.
19 4
        if (is_string($data)) {
20 2
            $data = ['fact'=>$data];
21 2
        }
22
23 4
        parent::__construct($data);
24 4
    }
25
26 4
    public function __toString()
27
    {
28 4
        return (string) $this->fact;
29
    }
30
31
    /**
32
     * Retrieve the fact property
33
     *
34
     * @return string|null
35
     */
36
    public function getFact()
37
    {
38
        return $this->fact;
39
    }
40
}
41