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

Fact   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 80%

Importance

Changes 2
Bugs 1 Features 1
Metric Value
wmc 4
c 2
b 1
f 1
lcom 0
cbo 1
dl 0
loc 34
ccs 8
cts 10
cp 0.8
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
A __toString() 0 4 1
A getFact() 0 4 1
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